Errors报错记录
- 前言
- Error1
- Error2
- Error3
- Error4
- Error5
- Error6
- Error7
- Error8
- Error9
- Error10
- Error11
- 总结
前言
记录运行程序时的错误,方便查找,主要包括python深度学习程序错误,opencv(c++)程序错误等,没有特定顺序,按照我遇到错误的时间添加
Error1
问题:运行yolo_test.py报错function takes exactly 1 argument (3 given)
分析:主要原因是输入的图片中有灰度图,而需要输入RGB的彩色图。
解决:在处理Image之前,添加一行代码,将灰度的图片转换为彩色图,彩色图依然是彩色图,这样就解决了问题。
Error2
问题:yolo3增加图片样本后在win7下可以运行,在Ubuntu上运行报错No such file or directory: '/home/keras-yolo3-master/VOCdevkit/'VOC2007/JPEGImages/202085-98.jpg
分析:没有找到文件类型的问题,目前遇到的有两种,第一种是路径错误导致无法找到,另一种为文件的格式不对导致无法找到,该错误属于后者,如下图所示的JPG格式的文件不规则,在windows上没有报错,但是在Ubuntu上显示为红色文件,读取不了导致报错。
解决:删除格式不规则的图像样本以及其xml文件,重新运行gen_main.py、voc_annotation.py文件生成新的TXT文件,注意删除后重启编辑器或者重启远程。
Error3
问题: opencv resize报错不存在从“int”转换到“cv::Size_<int>的适当构造函数”
分析:无法将int转换为cv::Size类型,opencv中的函数后面一段都是数据的类型,需匹配,否则报错。
解决:在前面加上Size数据类型。
Error4
问题:All 11 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
解决:找到项目->属性->链接器->优化
Error5
问题:在VS2017中调用python报错
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'Current thread 0x00003c8c (most recent call first):
分析:无法找到python
解决:将python路径添加环境变量PYTHONHOME和PYTHONPATH
添加后一定要重启电脑
后来使用的时候,出现Anaconda无法启动了,原因是修改了环境变量,删除PYTHONPATH的环境变量,保留PYTHONHOME,重启电脑,恢复正常。
Error6
问题:vs2017添加Qt时,设置Qt options报错
Error registering Qt version
分析:可能是Qt版本问题,重新安装其他版本后还是报错。
解决:卸载从VS界面中下载的Qt VS tools(版本不对导致报错)
从官网上找到对应版本,下载安装,再次设置Qt options,搞定。
Error7
问题:c++调用python中matplotlib库画图时报错
This application failed to start because it could not find or load the Qt platform plugin "windows"
分析:无法加载“windows”,这个错误搞了我半天时间,记录下来先。
解决:
step1: 找到安装anaconda的路径C:\ProgramData\Anaconda3
step2:搜索platforms,有几个文件夹,选择含qt的那个,如下图
step3:右键打开文件夹位置,找到qwindows.dll文件,这就是报错的根本原因
step4:将路径C:\ProgramData\Anaconda3\pkgs\qt-5.9.7-vc14h73c81de_0\Library\plugins\platforms添加到环境变量QT_QPA_PLATFORM_PLUGIN_PATH(没有就新建一个)中
step5:重启Vs,不行就重启电脑,再测试就没报错了。
//测试代码
#include<Python.h>void main() {Py_Initialize(); /*初始化python解释器,告诉编译器要用的python编译器*/PyRun_SimpleString("import matplotlib.pyplot as plt"); /*调用python文件*/PyRun_SimpleString("plt.bar([1,2,3],[2,1,3])"); /*调用python文件*/PyRun_SimpleString("plt.show()"); /*调用python文件*/Py_Finalize(); /*结束python解释器,释放资源*/system("pause");
}
结果如下:
Error8
问题:cython测试helloworld报错command 'cl.exe' failed: No such file or directory
分析:找不到cl.exe
解决:
step1:找到vs2017安装位置,通过桌面快捷方式定位,右键选择打开文件位置
step2:找到2017文件夹,因为我安装的是vs2017,若是其他版本注意路径
step3:在2017文件夹中搜索cl.exe
step4:打开cl.exe文件位置
step5:将路径添加到环境变量path
Error9
问题:cython测试helloworld报错“pyconfig.h”: fatal error C1083: 无法打开包括文件: “io.h”: No such file”
分析:无法打开io.h
解决:
step1:找到vs安装中的C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE找到vs安装中的C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin(此路径和Error8路径重叠,修改Error8中路径)将上述路径添加到path
step1:找到vs安装中的lib文件C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64在电脑中搜索Windows Kits找到ucrt中的lib文件D:\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64找到um中的lib文件D:\Windows Kits\10\Lib\10.0.17763.0\um\x64将上述三个路径添加到环境变量LIB中,需要自己新建
step2:找到vs安装中的include文件夹C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include找到Windows Kits文件夹下的D:\Windows Kits\10\Include\10.0.17763.0\ucrt将上述路径添加到环境变量INCLUDE中,需要自己新建
Error10
问题:cython测试helloworld报错“basetsd.h”: No such file or directory
分析:无法找到basetsd.h
解决:找到Visual Studio Installer修改,安装win10sdk
Error11
问题: import tensorflow出问题
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py
:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprec
ated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,
)type'._np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py
:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprec
ated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,
)type'.
分析:numpy版本过高
解决:降低numpy版本
pip install numpy==1.16.0
总结
之前好多错误都忘记记录,导致一个错误错好多遍,现在开始记录,这篇文章会不断更新,记录出现的每个错误。