
python的荒野
python & linux
飞行codes
资浅程序员,博士
展开
-
matplotlib将画的图像存于内存
io.BytesIO()原创 2025-01-15 15:22:27 · 217 阅读 · 0 评论 -
javascript document例子
.JS原创 2025-01-14 13:55:05 · 120 阅读 · 0 评论 -
FLASK 上传文件
路由原创 2025-01-13 15:14:53 · 575 阅读 · 0 评论 -
pyqt鸟瞰
内置银行家算法原创 2025-01-17 17:17:28 · 991 阅读 · 0 评论 -
pyqt关窗口相关
窗口关不掉?原创 2025-01-09 09:42:23 · 314 阅读 · 0 评论 -
pipy如何加速
使用Setuptools,开发者可以生成.egg文件或者直接将包安装到site-packages目录下,这样其他Python程序就可以通过import语句来导入和使用这个包。这个过程涉及到编译、打包和安装等多个步骤,而不仅仅是将文件拷贝到site-packages目录。因此,虽然最终的目的地是site-packages目录,但这个过程涉及到更多的步骤和操作,而不仅仅是简单的文件拷贝。是一个Python包管理工具,它允许程序员更方便地创建和发布Python包,特别是那些对其他包具有依赖性的包。原创 2024-08-23 09:50:34 · 427 阅读 · 0 评论 -
DBSCAN数学表示
一个点集原创 2024-07-04 11:58:30 · 208 阅读 · 0 评论 -
xgboost-GPU版本安装
亲测有效原创 2021-07-29 14:11:36 · 2160 阅读 · 0 评论 -
matplotlib画多排图
速查句柄原创 2021-05-24 15:55:08 · 210 阅读 · 0 评论 -
L1和L2拟合
误差平方放大的问题原创 2021-05-06 11:14:03 · 315 阅读 · 0 评论 -
error: Microsoft Visual C++ 14.0 is required
官网下载原创 2021-05-05 13:27:57 · 202 阅读 · 1 评论 -
为什么Precision高Recall就低——F1 score
F-score原创 2021-04-16 14:23:13 · 18871 阅读 · 2 评论 -
怎么查看GPU、CPU使用率
nvidia-smi -l原创 2021-03-15 17:43:51 · 1145 阅读 · 0 评论 -
linux安装和速用Qt creator
qss powered原创 2021-02-19 17:20:44 · 444 阅读 · 0 评论 -
win10非核心版本的计算机上
SLMGR命令原创 2021-02-09 23:56:01 · 19363 阅读 · 3 评论 -
docker删除镜像
第一步,先删除容器查看所有容器docker ps -a查看正在运行的容器docker ps所有处于终止状态的容器docker container prune 第二步,删除镜像查看镜像docker images删除镜像docker rmi 79cc46abd78d...原创 2020-09-15 10:26:16 · 213 阅读 · 0 评论 -
python语音识别依赖包
conda install -c contango python_speech_features原创 2020-08-25 14:35:43 · 376 阅读 · 0 评论 -
docker部署计算任务(numpy测试)
首先拉取镜像docker pull python:3.8import numpy as npx=np.random.randint(3,20,20).reshape(4,5)print(x)原创 2020-08-17 12:09:39 · 790 阅读 · 0 评论 -
Docker安装和入门,常用指令
可选择阿里云https://cr.console.aliyun.com/先后安装Docker客户端和配置镜像加速器。输入几行指令测试测试docker run hello-world免sudo:$ sudo groupadd dockersudo usermod -aG docker $USERnewgrp docker继续docker run busybox echo "hello from busybox"查看容器docker ps -a原创 2020-08-14 16:59:08 · 210 阅读 · 0 评论 -
查Python版本
python --version原创 2020-08-12 21:28:06 · 187 阅读 · 0 评论 -
python指定路径
写程序养成指定路径的习惯,否者经常运行发现路径不对很烦躁。import osos.chdir('/path')另外查看当前路径print(os.getcwd())原创 2020-07-17 11:54:50 · 1149 阅读 · 0 评论 -
python中的箭头符号
->这个符号仅仅是用于帮助阅读代码的,删掉也不影响代码def add(x, y) -> int: return x+yadd(1.2,2)Out[34]: 3.2所以并没什么用。再看一个判断机器人路径重叠的例子。class Robot: def isPathCrossing(self, path: str) -> bool: dirs = { "N": (-1, 0), "S": (1,原创 2020-07-07 11:20:36 · 6488 阅读 · 1 评论 -
~取反运算例子
原码,反码,补码。为什么需要三种码?计算机实际存储的都是补码。因为符号位!所以做加法直接用补码相加,正数的反码和补码就是原码本身。负数的反码即字面意思,符号位不变,其他各位取反。负数的补码是反码+1。还原:负数的反码还原为原码很简单,符号位不变,其他位取反。负数的补码还原为原码为:符号位不变,其他位取反再+1。即补码的补码就是原码。例:含符号位4位 mod8-5的补码是-3,-3的...原创 2020-04-14 17:47:17 · 1630 阅读 · 0 评论 -
Eight queens经典回溯算法
def conflict(state, nextX): print('state:',state) nextY = len(state) for i in range(nextY): print("i=",i) if abs(state[i]-nextX) in (0, nextY-i): print('conf...原创 2019-12-11 11:26:30 · 169 阅读 · 0 评论 -
np.where()巨型指导
涉及bool运算其实有点绕,官网太简洁,不好懂。Return elements, either fromxory, depending oncondition.If onlyconditionis given, returncondition.nonzero().1,一维数组情形import numpy as npx=np.random.randn(10)y=...原创 2019-11-25 11:13:22 · 720 阅读 · 0 评论 -
np.unique()例子
Find the unique elements of an array.Returns the sorted unique elements of an array. There are two optional outputs in addition to the unique elements: the indices of the input array that give the u...原创 2019-11-22 16:42:39 · 662 阅读 · 0 评论 -
数组之间的与和或逻辑运算np.all() np.any()
Test whether any array element along a given axis evaluates to True.Returns single boolean unlessaxisis notNoneimport numpy as npa=np.array(([1,2,3],[7,8,9]))b=np.array(([0,2,3],[7,8,9]))...原创 2019-11-22 15:20:40 · 1560 阅读 · 0 评论 -
python输出txt追加和重写模式
file = open(PATH+"write_test.txt", encoding="utf-8",mode="w") file.write("君臣佐使") file.write('\r\n')file.close() with open(PATH+"write_test.txt", encoding="utf-8",mode="a") as data: ...原创 2019-08-16 10:15:53 · 3167 阅读 · 0 评论 -
表格基本操作pandas和openpyxl
1, 创建表格from openpyxl import load_workbook,Workbook wb = Workbook()path = "/.../3.xlsx"wb.save(path)2, 写入表格import pandas as pddataFrame = pd.DataFrame(columns = {‘’,‘’ } )writer = pd.Exc...原创 2019-09-02 12:34:10 · 656 阅读 · 0 评论 -
两步搞定ubuntu18.04安装QQ,并实现屏幕共享,亲测
腾讯官方不做linux版QQ,而是第三方deepin-wine做的。第1步,下载和安装最新的deepin-wine环境:https://github.com/wszqkzqk/deepin-wine-ubuntu安装:sudo sh ./install.sh第2步,下载qq安装deb包阿里云http://mirrors.aliyun.com/deepin/pool/non-...原创 2019-03-20 10:35:01 · 4843 阅读 · 3 评论 -
python的bool()函数
bool()只有零元素和空数组才返回False,零元素数组返回True.import numpy as npdata = np.random.randn(7,5)A=[data>0]B=bool([0])C=bool(A)D=bool(0)E=bool([])接上,下面命令等效data [data > 0] = 0data [A] = 0dat...原创 2018-11-08 18:26:50 · 2450 阅读 · 0 评论 -
python自带的一些冷僻函数
repr()返回一个对象的 string 格式class EvalSegErr(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) if 1==1: raise EvalS...原创 2019-07-23 09:37:26 · 454 阅读 · 0 评论 -
关于python 条件语句if的遍历性
for i in range(10): if i == 1: print('p') elif i == 2: print('y') elif i == 3: print('t') elif i == 4: print('h') ...原创 2019-07-30 16:15:56 · 1354 阅读 · 0 评论 -
numpy.stack()系列
numpy.vstackStack arrays in sequence vertically (row wise).numpy.dstackStack arrays in sequence depth wise (along third axis).stackJoin a sequence of arrays along a new axis.vstackStack ...原创 2019-07-05 17:21:27 · 518 阅读 · 0 评论 -
python记时命令
import timestart_time = time.time()......print('Total processing time: {} seconds'.format(round(time.time() - start_time, 2)))输出:Total processing data time: 132.31 seconds或start_time = tim...原创 2018-12-26 18:11:17 · 353 阅读 · 0 评论 -
python vars()你可能没有彻底理解
先看官方文档vars([object])¶Return the __dict__ attribute for a module, class, instance, or any other object with a __dict__attribute.Objects such as modules and instances have an updateable __dict__ a...原创 2018-12-05 16:04:56 · 1403 阅读 · 0 评论 -
numpy.ones,numpy.zeros,tf.ones,tf.zeros,np.ones_like,tf.ones_like对比
numpy.ones_like(),numpy.zeros_like()>>> x = np.arange(6)>>> x = x.reshape((2, 3))>>> xarray([[0, 1, 2], [3, 4, 5]])>>> np.ones_like(x)array([[1, 1, 1]...原创 2018-12-05 12:09:46 · 1060 阅读 · 0 评论 -
python print format,颜色,%d%s%f用法速查
复盘利器原创 2018-11-27 15:52:22 · 3036 阅读 · 0 评论 -
python—命名规范
文件名全小写,可使用下划线包应该是简短的、小写的名字。如果下划线可以改善可读性可以加入。如mypackage, matplotlib类总是使用首字母大写单词串。如MyClass。内部类可以使用额外的前导下划线。类总是使用驼峰格式命名,即所有单词首字母大写其余字母小写。类名应该简明,精确,并足以从中理解类所完成的工作。常见的一个方法是使用表示其类型或者特性的后缀,例如:SQL...原创 2018-11-30 14:20:44 · 3999 阅读 · 0 评论 -
python 求两个集合的交集
绕口令原创 2018-11-29 14:24:37 · 3327 阅读 · 0 评论