Anaconda (Miniconda) environment configuration

Anaconda (Miniconda) is a release version that can easily obtain packages and manage packages, and can manage the environment in a unified manner. With Anaconda (Miniconda) installed, there is no need to install a python interpreter separately. If you want to save hard disk capacity, it is recommended to install Miniconda.

1. Configure Tsinghua source

Some library servers are located abroad, and our direct installation will be very slow. At this time, we need to download from domestic sources; there are two ways: one is a once-and-for-all method, just configure the .condrac configuration file directly; the other is to install the command Then directly follow the domestic source address. I haven't used the source very much now, and the speed of downloading and installing directly is still fast.

1.1 How to configure the .condrac file:

URL: https://mirror.tuna.tsinghua.edu.cn/help/anaconda/
insert image description here

1.2 The installation command is followed by the source address

It is not necessary to use Tsinghua source, it can also be Douban source or Alibaba cloud source, etc... whichever is convenient is fine.
For example:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple matplotlib scikit-learn
# 豆瓣源
https://pypi.doubanio.com/simple
# 阿里云源
http://mirrors.aliyun.com/pypi/simple

2. Common commands

2.1 Create a new environment

conda create --name 环境名 python=3.9   # 创建一个名为 环境名 的环境,环境中安装版本为3.9的版本

2.2 View several environments installed

conda info --envs

2.3 Activate the environment

conda activate 环境名

2.4 Exit the environment

conda deactivate

2.5 Delete environment

conda remove -n 环境名 --all

2.6 Query the version of the extension library available for installation

conda search --full -name pandas

2.7 Get information about the installed extension library in the current environment

conda list

2.8 Updating the library

pip/conda  install --upgrade xxxx

2.9 Install related libraries in the current environment

pip/conda install numpy

2.7 Uninstall related libraries in the current environment

pip uninstall 包名
conda remove 包名

2.8 Uninstall related libraries in the specified environment

conda remove  环境名 包名

2.9 View the versions of all installed libraries

pip freeze

2.10 Check graphics driver

nvidia-smi
watch -n 0.1 nvidia-smi  # 查看实时调用gpu情况

2.11 Determine whether torch has been successfully installed as cuda version

import torch
torch.cuda.is_available()

2.12 View cuda under the current path

nvcc -V

2.13 Copy the Anaconda virtual environment on this machine

conda create-n 新环境名 --clone 旧环境名

3. Install pytorch

Determine the version number of your graphics card driver, select the corresponding system, and copy the command to install it.
URL: https://pytorch.org/get-started/locally/
insert image description here

4.pycharm uses Anaconda

insert image description here
insert image description here
insert image description here
insert image description here

5. Other websites

CUDA installation address: https://developer.nvidia.com/cuda-toolkit-archive
CUDA installation version view: https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
Anaconda download address : https://www.anaconda.com/products/individual
Tsinghua mirror website: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
Graphics ladder map: https://www.mydrivers.com/ zhuanti/tianti/gpu

Guess you like

Origin blog.csdn.net/lucky_mmg/article/details/126110530
Recommended