
python
假装是程序员
这个作者很懒,什么都没留下…
展开
-
conda创建环境时出错Solving environment: failed
使用conda创建一个虚拟环境时出现问题,出错界面与博文(https://blog.youkuaiyun.com/zhicheng_angle/article/details/103702209/#commentBox)类似,An unexpected error has occurred. Conda has prepared the above report.If submitted, this report will be used by core maintainers to improvefutu.原创 2021-03-26 15:09:59 · 2935 阅读 · 0 评论 -
pip安装因网络原因失败
pip install 时有时因网速慢而安装失败,可以设置下载等待时间。pip install --default-timeout=1000 <package name>原创 2021-03-25 11:19:40 · 499 阅读 · 0 评论 -
pip下载安装软件超时
设置默认超时时间,如:pip --default-timeout=1000 install torch。原创 2020-12-07 17:00:10 · 272 阅读 · 0 评论 -
python错误 IndentationError:unexpected indent
在修改python文件时顶格添加注释,执行后,出现错误IndentationError:unexpected indent,此错误一般为缩进问题,python缩进一般为4个空格,修改缩进对齐后不再报错。原创 2020-06-29 16:25:28 · 402 阅读 · 0 评论 -
python生成图像样本的训练集、验证集和测试集
准备好图像样本和标注文件后,需对样本集进行划分,生成训练集、验证集和测试集,关于训练集划分参考:https://blog.youkuaiyun.com/kieven2008/article/details/81582591 我的目录结构:——data ——image ——0.jpg ——1.jpg . . . ——labels ——0.txt ——1.txt . . ...原创 2020-05-14 15:55:41 · 3535 阅读 · 0 评论 -
python 将一个文件夹中的多个文件复制到多个新建的文件夹中
前两天采集了一些数据,数据量2000多张图片,图像命名为0.jpg、1.jpg、2.jpg……为了分散标注和管理这些数据,新建一些文件夹,文件命名为0、1、2、3。。。,每个文件夹中存放500张图片,便于后期标注管理。 在存图像的文件夹的上一级目录,写python程序:import osimport shutilosDir=os.getcwd()fileDir=osD...原创 2020-03-13 17:04:54 · 1814 阅读 · 0 评论 -
python:AttributeError: module 'enum' has no attribute 'IntFlag'
安装anaconda3结束时提示: AttributeError: module 'enum' has no attribute 'IntFlag'原因时在安装anaconda之前没有将.bashrc中PYTHONPATH的其他值注释掉(如python2的设置),python3不能找到正确的enum位置,在.bashrc中注释掉之前的PYTHONPATH,重新安装既可。...原创 2019-12-21 16:59:54 · 1102 阅读 · 0 评论 -
python strip()和split()函数
1.strip函数 str.strip([chars]) 返回移除字符串头尾指定的字符生成的新字符串 例1: str = "00000003210Runoob01230000000"; print str.strip( '0' ); 输出:3210Runoob0123 例2: str2...原创 2018-10-31 15:31:20 · 268 阅读 · 0 评论 -
os.walk()
一篇讲的很好的博客:http://www.cnblogs.com/herbert/archive/2013/01/07/2848892.html转载 2018-04-07 20:04:05 · 139 阅读 · 0 评论 -
string split字符串分裂成多个字符串组成的列表
出处:https://www.cnblogs.com/douzi2/p/5579651.htmlsplit翻译为分裂。 split()就是将一个字符串分裂成多个字符串组成的列表。split()当不带参数时以空格进行分割,当代参数时,以该参数进行分割。//---当不带参数时example:st0= ' song huan gong转载 2018-01-06 22:14:35 · 7641 阅读 · 0 评论 -
python语句块注释
python注释的三种方法:1.井号注释单行 #2.三个单引号或三个双引号注释语句块 " " "3.井号加两个百分号画出语句块分界线 #%%"""@author: zhijuan"""#%%def add(x,y): return x+y #return the sum of x and y#%%'''the mian function'''原创 2017-12-14 15:27:58 · 22188 阅读 · 2 评论