Happy to use Python related records, mirror replacement, etc. for your own use

foreword

Mainly for yourself to use python in the mainland to install related libraries and use them. Note that some of the following are shown in the reference link. Please pay attention to copyright awareness. Go to the original link to view more information

Generally, I have experience in using windows and ubuntu, and there is also ros on it, so it is necessary to manage the py version, because conda is the first to contact, so conda is the main choice, and the conflict with ros can be resolved through conda deactive Solved; of course, there is also venv for management. See the Environmental Management section for more

change source

pip install

Reference: https://blog.csdn.net/xuezhangjun0121/article/details/81664260

temporary use

You can add the -i parameter after using pip to specify the pip source

pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple

permanent modification

linux:
modify ~/.pip/pip.conf (create one if there is none), the content is as follows:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

Windows:
Create a pip directory directly in the user directory, such as: C:\Users\xx\pip, create a new file pip.ini, the content is as follows

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

conda install

sudo gedit ~/.condarc

Replace the original with the following direct copy:

channels:
  - defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

environmental management

Conda

venv

Official documentation usage: https://docs.python.org/3/library/venv.html#

Guess you like

Origin blog.csdn.net/qq_39537898/article/details/127024486