赞
踩
安装PyTorch后,import torch出现:
OSError: [WinError 126] 找不到指定的模块。 Error loading “D:\Anaconda\envs\torch2\lib\site-packages\torch\lib\nvfuser_codegen.dll” or one of its dependencies.
这个还是安装的时候出的问题,建议重新安装PyTorch,这里给出CUDA 11.8、PyTorch2.1.2的安装指令:
conda install pytorch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 pytorch-cuda=11.8 -c pytorch -c nvidia
安装PyTorch后,import torchvision出现:
ImportError: cannot import name ‘packaging’ from ‘pkg_resources’ (D:\Anaconda\envs\torch2\lib\site-packages\pkg_resources_init_.py)
先检查setuptools是否为70.0.0及以上的版本,比如使用conda list检查:
如果是70.0.0及以上的版本,需要降低版本
python -m pip install setuptools==69.5.1
Collecting matplotlib>=3.3 (from -r requirements.txt (line 5))
Could not fetch URL https://pypi.python.org/simple/matplotlib/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748) - skipping
Could not find a version that satisfies the requirement matplotlib>=3.3 (from -r requirements.txt (line 5)) (from versions: )
No matching distribution found for matplotlib>=3.3 (from -r requirements.txt (line 5))
这是pip源的问题,选择国内源即可解决:
pip install matplotlib -i http://pypi.douban.com/simple/
File “/opt/conda/lib/python3.10/site-packages/cv2/init.py”, line 181, in
bootstrap()
File “/opt/conda/lib/python3.10/site-packages/cv2/init.py”, line 153, in bootstrap
native_module = importlib.import_module(“cv2”)
File “/opt/conda/lib/python3.10/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
这个错误表明Python程序试图导入一个模块或库,而这个库依赖于名为libGL.so.1的共享对象文件,但是系统无法找到这个文件。libGL.so.1是OpenGL的GPU渲染库,通常由图形驱动程序提供。
安装依赖项 libgl1 就可以了,指令如下:
apt-get update && apt-get install libgl1
File “/root/workspace/YOLO/utils/general.py”, line 581, in check_dataset
check_font(“Arial.ttf” if is_ascii(data[“names”]) else “Arial.Unicode.ttf”, progress=True) # download fonts
File “/root/workspace/YOLO/utils/general.py”, line 516, in check_font
torch.hub.download_url_to_file(url, str(file), progress=progress)
File “/opt/conda/lib/python3.10/site-packages/torch/hub.py”, line 597, in download_url_to_file
u = urlopen(req)
可以在github上找到Arial.Unicode.ttf 字体,进行下载:https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf
下载好后,使用mv指令存到linux系统的字体位置中,如:
mv Arial.Unicode.ttf /root/.config/Ultralytics/
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。