ubuntu20.04安装yolov5及环境配置(踩坑记录) |
您所在的位置:网站首页 › 如何安装yolov5的requirement › ubuntu20.04安装yolov5及环境配置(踩坑记录) |
安装pytorch
官方链接 PyTorch 可以安装最新的2.0版本,选择适合自己硬件的版本进行安装,也可选择其他的版本进行安装。 查看是否安装显卡 lspci | grep -i nvidia查看显卡信息 nvidia-smi
在NVDIA官网下载你需要的CUDA版本,本文下载的CUDA10.2。根据官网的提示选择。
输入accept 配置环境变量 在终端输入gedit ~/.bashrc命令打开文件,在文件结尾输入以下语句,保存。 export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}更新环境变量配置 source ~/.bashrc 安装cuDNN在官网中下载对应版本的cudnn,需要登陆,CUDA10.2版本推荐安装cuDNN v7.6.5版本的。 下载解压之后,将cuda/include/cudnn.h文件复制到usr/local/cuda-10.2/include文件夹,将cuda/lib64/下所有文件复制到/usr/local/cuda-10.2/lib64文件夹中,根据实际路径选择。 sudo cp cuda/include/cudnn.h /usr/local/cuda-10.2/include sudo cp cuda/lib64/libcudnn* /usr/local/cuda-10.2/lib64添加读取权限: sudo chmod a+r /usr/local/cuda-10.2/include/cudnn.h sudo chmod a+r /usr/local/cuda-10.2/lib64/libcudnn* 安装yolov5注意前置条件:Python>=3.6.0 is required with all requirements.txt installed including PyTorch>=1.7: 使用以下命令进行安装 git clone https://github.com/ultralytics/yolov5 cd yolov5 pip3 install -r requirements.txt 安装过程中可能遇到的问题pip安装包时出现 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) pip下载速度慢,连接超时, 解决方法: 方法一:更改超时时间添加 --default-timeout pip3 install --default-timeout==500 -r requirements.txt下载速度会比较慢,不见一使用 方法二:可以直接在pip命令后面添加镜像地址 pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/Python默认的pip包来源是国外的Pypi服务站点:https://pypi.python.org/simple,这样可以加快下载速度。 国内常用的镜像站点 清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/ 中科大:https://mirrors.ustc.edu.cn/pypi/web/simple/ 豆瓣:http://pypi.doubanio.com/simple/ 阿里云:http://mirrors.aliyun.com/pypi/simple/ 安装后出现 ERROR: pip‘s dependency resolver does not currently take into account all the packages that are inst 原因:缺少相对应的包 解决方法: 使用pip install 命令安装相应的包 ubuntu pip安装报错 which is not on PATH warnning信息 WARNING: The script normalizer is installed in '/home/***/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.解决方法: 配置环境变量 打开bashrc文件 : gedit ~/.bashrc在文件末尾添加安装pip发出警告的路径 export PATH=/home/***/.local/bin:$PATH source ~/.bashrc |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |