python 深度学习 解决遇到的报错问题8

本篇继python 深度学习 解决遇到的报错问题7-CSDN博客

目录

[一、OSError: [WinError 127] 找不到指定的程序。 Error loading "D:\my_ruanjian\conda-myenvs\deeplearning\lib\site-packages\torch\lib\caffe2_detectron_ops.dll" or one of its dependencies.](#一、OSError: [WinError 127] 找不到指定的程序。 Error loading "D:\my_ruanjian\conda-myenvs\deeplearning\lib\site-packages\torch\lib\caffe2_detectron_ops.dll" or one of its dependencies.)

[二、proj.db contains DATABASE.LAYOUT.VERSION.MINOR = 0 whereas a number >= 2 is expected. It comes from another PROJ installation](#二、proj.db contains DATABASE.LAYOUT.VERSION.MINOR = 0 whereas a number >= 2 is expected. It comes from another PROJ installation)

[三、 There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:1002)'))) - skipping](#三、 There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:1002)'))) - skipping)

[四、Max retries exceeded with url: /pkgs/main/linux-64/current_repodata.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:1002)')))](#四、Max retries exceeded with url: /pkgs/main/linux-64/current_repodata.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:1002)'))))

[五、ImportError: cannot import name 'clock' from 'time' (unknown location)](#五、ImportError: cannot import name 'clock' from 'time' (unknown location))

[六、UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x00000200EDD9BEA0>](#六、UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x00000200EDD9BEA0>)


一、OSError: [WinError 127] 找不到指定的程序。 Error loading "D:\my_ruanjian\conda-myenvs\deeplearning\lib\site-packages\torch\lib\caffe2_detectron_ops.dll" or one of its dependencies.

报错:

原因:是由于torchtorchaudio版本不匹配导致的

解决方法:

二、proj.db contains DATABASE.LAYOUT.VERSION.MINOR = 0 whereas a number >= 2 is expected. It comes from another PROJ installation

场景:最近发现一个问题,在使用GDAL+Python进行开发时,代码总报如下错误:

原因:从错误里可以看出,GDAL在调用PROJ时,遇到了版本冲突的问题。

  1. GDAL底层使用PROJ的库,进行坐标系相关的转换;
  2. PostgreSQL数据库插件PostGIS 也是使用了PROJ;

两个工具安装的PROJ库版本不一样,且在计算机环境变量里相互干扰。

解决方法:找到对应自己的python包的安装地址,

复制代码
import os
# 对应自己的python包的安装地址
os.environ['PROJ_LIB'] = r'D:\my\python-pycharm\python-envs\pathplanning\Lib\site-packages\pyproj\proj_dir\share\proj'

然后运行代码时,就不报错误了。

三、 There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:1002)'))) - skipping

报错:使用pip install 某个包的时候报错

原因分析:无法访问到https://pypi.tuna.tsinghua.edu.cn/simple/pip,SSL证书认证问题。

解决方法:此时需要获得 ssl证书的认证,需要在原来的安装命令后增加:-i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com (也可换其他源),这是阿里源 --trusted-host mirrors.aliyun.com 这是为了获得ssl证书的认证。

四、Max retries exceeded with url: /pkgs/main/linux-64/current_repodata.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:1002)')))

报错:在我设置好国内源之后,用conda创建虚拟环境,下载python版本时出现以下错误

原因分析:从错误信息看是无法获取资源https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/current_repodata.json, 进而通过wget命令尝试获取该资源

解决方法:在命令行中输入conda config --set ssl_verify false修改设置,或者在文件~/.condarc末尾添加一行ssl_verify: false(有则修改即可),把清华源那些链接里的https改成http。

五、ImportError: cannot import name 'clock' from 'time' (unknown location)

报错:

原因:这个问题通常出现在Python 3.8版本之后,因为在Python 3.8中,time模块中的clock()函数被废弃,取而代之的是perf_counter()函数和process_time()函数。

解决方法:那么,解决这个问题的方法就是使用perf_counter()函数或process_time()函数替代clock()函数。这两个函数分别用于性能计数和进程计时,能够更准确地测量时间。

复制代码
from time import process_time as timer

timer()

六、UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x00000200EDD9BEA0>

报错:

原因:这个链接是一张图片,但是python读取不到图片,报错了,可能是图片的问题导致读取不出来。

复制代码
https://images.mulberry.com/i/mulberrygroup/RL5792_000N651_L/small-hampstead-deep-amber-small-classic-grain-ayers/small-hampstead-deep-amber-small-classic-grain-ayers?v=3&w=304

解决方法:将图片报错到本地,将filepath的路径改为本地路径

复制代码
img = Image.open('../images/pack.jpg')
相关推荐
一个天蝎座 白勺 程序猿2 分钟前
GpuGeek全栈AI开发实战:从零构建企业级大模型生产管线(附完整案例)
人工智能·gpugeek
love530love4 分钟前
家用或办公 Windows 电脑玩人工智能开源项目配备核显的必要性(含 NPU 及显卡类型补充)
人工智能·windows·python·开源·电脑
深圳市青牛科技实业有限公司6 分钟前
D2203使用手册—高压、小电流LDO产品4.6V~36V、150mA
人工智能·单片机·嵌入式硬件·电动工具·工业散热风扇
shengjk111 分钟前
序列化和反序列化:从理论到实践的全方位指南
java·大数据·开发语言·人工智能·后端·ai编程
AI大模型顾潇11 分钟前
[特殊字符] 本地大模型编程实战(29):用大语言模型LLM查询图数据库NEO4J(2)
前端·数据库·人工智能·语言模型·自然语言处理·prompt·neo4j
passionSnail26 分钟前
《用MATLAB玩转游戏开发》推箱子游戏的MATLAB趣味实现
开发语言·游戏·matlab
2501_9153743526 分钟前
数据清洗的艺术:如何为AI模型准备高质量数据集?
人工智能·机器学习
心足27 分钟前
我喜欢的vscode几个插件和主题
ide·vscode·编辑器
山北雨夜漫步29 分钟前
机器学习 Day17 朴素贝叶斯算法-----概率论知识
人工智能·算法·机器学习
愚公搬代码42 分钟前
【愚公系列】《Manus极简入门》038-数字孪生设计师:“虚实映射师”
人工智能·agi·ai agent·智能体·manus