Article Directory
Foreword
pip install package-name
Command from official sources (direct https://pypi.python.org/pypi ) is mounted, moving speed, when the installation package can be, -i
plus pypi source address, the source address may be changed domestic pip mirror station address, once and for all, the speed has improved significantly
Configuration
1. psm
Source github Address: https://github.com/brandonxiang/psm
This article uses the virtual environment pyenv created, python version is 3.6.6, pip version 19.1.1, create a virtual environment with pyenv python tutorial can blog https://blog.csdn.net/qq_27114273/article/details/ 90,340,754 find, not repeat them, created after the completion of the command pyenv activate env-name
into the virtual environment. The same can also be used in combination virtualenv virtualenvwrapper to create a virtual environment, designated as a python version of the system environment.
Linux use
The following operation needs to be performed outside the virtual Linux environment, choose a good mirror source entering the virtual environment
(env366)vic@hell:~$ pip install psm
If the system is equipped with both python2 and python3, want to install python3 environment, you need
pip3 install psm
to install
- The mirror source listed pip
(env366)vic@hell:~$ psm ls
psm support domestic mirroring as follows:
- pypi https://pypi.python.org/simple/
- douban http://pypi.douban.com/simple/
- aliyun http://mirrors.aliyun.com/pypi/simple/
View the current mirror source
(env366) vic@hell:~$ psm show
Current source is douban
- Select the specified mirror source
(env366) vic@hell:~$ psm use douban
Source is changed to douban.
- Use pip Download Library
(env366) vic@hell:~$ pip install package-name
Windows use
installation
pip install psm
Likewise, you want to install python3 version, then use pip3 install psm
to install
List all sources
python -m psm ls
Pypi replacement source
python -m psm use douban
Displays the current source
python -m psm show
2. modify the configuration file
- Ali cloud http://mirrors.aliyun.com/pypi/simple/
- China University of Science and Technology https://pypi.mirrors.ustc.edu.cn/simple/
- Watercress http://pypi.douban.com/simple/
- Tsinghua University https://pypi.tuna.tsinghua.edu.cn/simple/
- University of Science and Technology of China http://pypi.mirrors.ustc.edu.cn/simple/
- Huazhong University of Science http://pypi.hustunique.com/
- Shandong University of Technology http://pypi.sdutlinux.org/
- v2ex http://pypi.v2ex.com/simple/
Change the profile, the pip set as the default source, for example switching to open-source software mirror sites Tsinghua University, Tsinghua PyPI mirror image of the station sync once every 5 minutes. But Tsinghua TensorFlow updated more slowly.
Temporary use can use the command
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple package-name
Linux under modification
pip version> = 10.0.0
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
When the network is poor, using the mirror Tsinghua station to upgrade pip:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U
If you do not want to upgrade version of pip, pip mirror source can be switched by modifying the configuration file
Modify ~ / .pip / pip.conf file, add the following, there is no such file or directory to create a
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn/simple
Modify under Windows
- In the address bar of the file manager
%APPDATA%
will switch to the user directory path appdata - pip directory to find the file in the folder, not to create a new folder for the pip, create a file pip.ini In this folder, the full path
%APPDATA%/pip/pip.ini
- Add the following code in pip.ini
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn/simple
Mac under modification
- Pip switching to the path, the path is:
$HOME/Library/Application Support/pip/pip.conf
%HOME%
For the user's home directory
- Without the above directory, create a file in the following directory pip.conf
$HOME/.config/pip/pip.conf
- Add the following code
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn/simple
note
After adding the code modification profile, it may be wrong, to make use of encryption source https
Open source software reference mirror sites Tsinghua University, pypi mirroring Help: https://mirrors.tuna.tsinghua.edu.cn/help/pypi/