包的安装
pytorch利用pip安装教程
pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 -f https://download.pytorch.org/whl/torch_stable.html
查看服务器的cuda版本
ls -l /usr/local | grep cuda
之后在pytorch官网找到torch和torchvision对应的版本,在https://download.pytorch.org/whl/torch_stable.html该网址找到torch和你的电脑cuda对应的版本。
# 如果安装的cuda版本不匹配
RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED
pip查看可安装的包的版本
以scikit-learn为例
pip install scikit-learn==
输入命令后显示的结果:
note: This error originates from a subprocess, and is likely not a problem with pip.
我在安装scikit-learn==0.23.2时报错,采取的解决办法如下:
- 给python降级,我原型安装的版本是3.10.2,现在换成3.7版本。
conda install python==3.7
成功安装包
删除无用的包:conda clean -a
https://blog.csdn.net/m0_56077202/article/details/120144424
conda的清理一些细节补充:链接
conda安装镜像源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
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/r
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
conda创建,复制和删除环境
conda create -n crowdTh python==指定的python版本
conda create -n crowdTh --clone crowdCo
conda remove -n crowdTh --all
conda 解决An HTTP error occurred when trying to retrieve this URL.(已经更新清华源但也无解的解决方法)
https://blog.csdn.net/viki_2/article/details/118893250
pip安装镜像源
在下载pytorch的包时,发现中科院的镜像源速度最快,建议采用
pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple/