pip源
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ [pkgname]
pip install -i https://pypi.doubanio.com/simple [pkgname]
# 更新包
pip install --upgrade pkg
pytorch anaconda 安装
更新conda
conda update -n base -c defaults conda
安装pytorch
conda install pytorch torchvision cuda90 -c pytorch
环境输出到txt
pip freeze >requirements.txt
opencv安装
pip install opencv_python==3.4.2.16
pip install opencv-contrib-python==3.4.2.16
查看cuda版本
cat /usr/local/cuda/version.txt
查看cudnn版本
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
- pytorch查看cudnn版本
import torch
print(torch.backends.cudnn.version())
安装pytorch很慢,离线安装pytorch
https://blog.csdn.net/chenxp106/article/details/82793149
https://www.jianshu.com/p/5aec0a02b80b
安装anaconda,下载离线版本pytorch
https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/
conda install numpy mkl cffi
conda install --offline pytorch-1.1.0-py3.7_cuda9.0.176_cudnn7.5.1_0.tar.bz2
conda 换源
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/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda 重置源
conda config --remove-key channels
conda 环境
# 新建环境
conda create -n envname python=3.6
# 切换、激活环境
conda info -e
source activate envname # linux
activate envname # windows
# 删除环境
conda remove -n envname --all
启动ssh
service ssh restart
pycharm
- ImportError: libcudart.so.10.0: cannot open shared object file: No such file or directory
sudo ldconfig /usr/local/cuda-10.0/lib64
windows下conda命令窗口目录无法切换?
使用完整的路径运行目标安装程序 python D:/program_path/program.py
添加环境变量
export PATH=$PATH:/your_new_path
# $PATH 是指原来的环境变量,不加这个则会删除原来的,只有新的
# 运行报错
export PATH=$PATH:/usr/local/cuda-10.0/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda-10.0/lib64
source /etc/profile
# 永久添加环境变量
vi ~/.bashrc
export ...
source ~/bashrc
jupyter notebook
conda install nb_conda
pip install jupyter notebook
## 启动
jupyter notebook --ip 192.11..... --port 88..
根据返回的ip启动 jupyter notebook
anaconda虚拟环境下重装 cudatoolkit,cudnn
https://blog.csdn.net/qq_38163755/article/details/88583016
- 新建虚拟环境
- 如果已经有虚拟环境则需要删除 相关包
conda uninstall cudnn
conda uninstall cudatoolkit
- 安装cudatoolkit和cudnn
conda install cudatoolkit=9.0
conda install cudnn
网友评论