Anaconda configures the specified environment, commonly used summary

1. Install Anaconda: Anaconda detailed installation and usage tutorial (with pictures and text)

Download address: Anaconda | Anaconda Distribution

a. Install in the default order, remember to change the path, and cancel the automatic opening option when finishing.

b. Configure environment variables: Windows: Add the Scripts folder of anaconda's installation directory to This Computer\Properties\Control Panel\System and Security\System\Advanced System Settings\Environment Variables\User Variables\PATH

 For example, my path is C:\ProgramData\Anaconda2\Scripts

c. Check: cmd opens the command line (administrator mode) and enters: conda --version

If something like: conda 4.5.4 appears, it means the environment variable is set successfully.

d. Enter conda upgrade --all to upgrade all tool packages first.

2. Create an independent virtual environment


activate

activate can bring us into the virtual environment set by anaconda. If you don't add any parameters later, it will enter the base environment that comes with anaconda.

Create a virtual environment named python34 and specify the python version as 3.4 (here conda will automatically find the latest version in 3.4 to download): conda create -n python34 python=3.4


If an error occurs:

 CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is

conda install cannot be installed, prompting CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is

 the solution:

1. Go to your anaconda installation directory: for example, D:\ProgramData\ Anaconda3 \Library\bin, and find the following two DLL files:

libcrypto-1_1-x64.dll

libssl-1_1-x64.dll

 2. Copy to D:\ProgramData\Anaconda3\DLLs


If the error is reported again: UnavailableInvalidChannel: The channel is not accessible or is invalid

There is a problem with the environment configuration: Anaconda reports an error when creating a virtual environment—UnavailableInvalidChannel: The channel is not accessible or is invalid

# 恢复默认源
conda config --remove-key channels

# 修改镜像源
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 --show channels

3.Others

# 去查看所有的环境
conda env list

# 切换到 my_test
conda activate my_test

# 退出当前环境
deactivate python34

# 安装包
conda install ipykernel
pip install requests

# 卸载包
pip uninstall requests

# 卸载环境
conda remove --name test --all

# 查看环境包
conda list

# 安装指定环境的包
pip install package==version

# I really have to check it again every time I change it. I’m just too lazy to remember it. Let’s summarize it.

Guess you like

Origin blog.csdn.net/sky_ying/article/details/129779071