Linux under conda configure the virtual environment: python + pytorch

 

Linux under conda configure the virtual environment: python + pytorch

The default has been installed conda

Create a virtual environment

conda create and activate a virtual environment

command:

conda create -n your_env_name python=2.7/3.6
source activate your_env_name

Which, -n where n is a name, that is, you create the name of the environment.
If you forget your own name after the creation of the environment, you can view conda in the environment:

conda env list

After you select the environment you create activation. After entering pytorch official website select the version you want to install, and operating system, CUDA version number, you can get the download command. For example, the command I get is:

conda install pytorch torchvision cuda80 -c pytorch

CUDA does not know the version number of your own, you can enter the following command to query:

cat /usr/local/cuda/version.txt

If you want to quickly download, you can change the source for domestic mirror source, thereby increasing the download speed. Before downloading, enter:

vim ~/.condarc

After opening the file, enter:

channels:
- https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
- https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
show_channel_urls: true

If the configuration of the environment require other packages, with conda or pip download Jieke

Guess you like

Origin www.cnblogs.com/klausage/p/11864623.html