首页IT科技anaconda cudatoolkit(入门Anaconda cuda yolov5 安装排坑)

anaconda cudatoolkit(入门Anaconda cuda yolov5 安装排坑)

时间2025-05-22 07:00:04分类IT科技浏览4796
导读:主要参考了 这篇博客 的流程,但是期间还是遇到不少问题...

主要参考了  这篇博客  的流程,但是期间还是遇到不少问题

首先pytorch的安装,除了pytorch 还有torchvision torchaudio,对版本的匹配要求高,可以先试试pytorch首页的安装方式,如果不行,就去该网址去安装老版本https://pytorch.org/get-started/previous-versions/

去英伟达开发者网站查阅显卡驱动对应CUDA toolkit版本 并下载

https://developer.nvidia.com/cuda-toolkit-archive

安装pytorch过程中,可以添加清华源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ conda config --set show_channel_urls yes

如果用清华源和阿里源,也出现版本不匹配,安装失败的问题,最后是挂梯子下的

如果安装成功,执行下面的的命令都会顺利。。。

import torch print(torch.cuda.is_available()) print(torch.backends.cudnn.is_available()) print(torch.cuda_version) print(torch.backends.cudnn.version())

 pycharm建立工程时,一定要选择安装了pytorch环境的interpreter,如果是base环境,就是anaconda的目录下的python.exe,否则就是对应环境下的python.exe

怎么看加对了,右下角点进去interpreter setting里面,点进来中间的框会出现很多package,包含了要用的pytorch等包

imglabeling 安装出错

一般都介绍pip install的方法,但安装之后再次出现版本不匹配的问题安装不了

去https://github.com/heartexlabs/labelImg

下载代码,然后按照后面的windows+anaconda方案安装完成

如直接使用yolo 里面自动数据集,可能会出现,

raise ImportError("Failed to initialize: {0}".format(exc)) from exc

ImportError: Failed to initialize: Bad git executable.

The git executable must be specified in one of the following ways:

    - be included in your $PATH

    - be set via $GIT_PYTHON_GIT_EXECUTABLE

    - explicitly set via git.refresh()

意思是git没有加入环境变量

在import os 后面加入一句

os.environ["GIT_PYTHON_REFRESH"] = "quiet"

 yolov5成功做了一次网络摄像头识别,然后同时安装了其他包,就再也不能跑了,提示OpenCV 需要rebuild

报错里面有这么一段:

Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, instal

解决方法:

pip install opencv-contrib-python -i https://pypi.tuna.tsinghua.edu.cn/simple

创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!

展开全文READ MORE
vue elementui 文件上传(Vue中使用的el-upload时批量上传图片时报错问题处理)