0%

conda配置PyTorch环境

配置了n遍环境,记一下过程吧…省的每次都百度…

conda

Download & install

官网https://docs.conda.io/en/latest/miniconda.html

1
2
3
wget -r https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod 777 Miniconda3-latest-Linux-x86_64.sh
sh Miniconda3-latest-Linux-x86_64.sh

加入环境变量

1
2
source ~/.bashrc
conda

添加清华源

1
2
3
4
5
6
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/bioconda/
conda config --set show_channel_urls yes
conda config --get channels

Create new conda env

1
2
conda create -n pytorch python=3.7.2
conda activate pytorch

Pytorch

Download & install

官网https://pytorch.org/get-started/locally/

1
conda install pytorch torchvision cudatoolkit=10.2 -c pytorch

Other

其他可能用得到的

1
2
3
4
conda install pandas
conda install jupyter notebook
conda install matplotlib
pip install sklearn

Screen

让ssh退出依然运行命令

1
2
3
4
5
6
7
8
9
apt-get install screen
screen -S test # 创建
command...
screen -r test # 恢复
screen -ls
screen -d test # 退出
exit
screen -wipe test # 删除
screen -S test -X quit # kill and exit

Have fun.