Accelerating the online installation of Third-party libraries using the PyPI mirror source

Source: Internet
Author: User
To specify mirrors manually

It is convenient to install a Third-party library with Easy_install and PIP
They are actually downloaded from the official source pypi.python.org/pypi of Python to the local and then unpack the installation.
But for some reason, the official pypi is unstable, slow or even inaccessible.
Like Ubuntu's apt and CentOS's yum have each mirror source, PyPI also has. Domestic Mirror

PIPY Domestic Mirror currently has:

http://pypi.tuna.tsinghua.edu.cn/
http://pypi.mirrors.ustc.edu.cn/University of  Science and technology of China
http:// pypi.douban.com/  watercress
http://pypi.hustunique.com/  Huazhong University of Technology
http://pypi.sdutlinux.org/  Shandong University of Technology

This is handy for Pip, which is an online installation, but it's a terrible thing if the network is unstable. Use the domestic mirror relatively better, use the way

If you want to specify the source manually, you can specify the source behind the PIP, such as the source of the watercress, to install the web.py frame:

Pip install-i http://pypi.tuna.tsinghua.edu.cn/simple/requests
pip install requests-i http://pypi.douban.com/ simple/
pip Install-i http://pypi.douban.com/simple/gevent 

Note: There is a/simple/directory to follow ... made a mistake.

The PIP was upgraded today, and then the PIP was used to specify a mirrored installation and an error.

Collecting requests the
  repository located at pypi.douban.com isn't a trusted or secure host and is being ignored. If This repository is available via HTTPS it are recommended to use HTTPS instead otherwise your may silence this warning a nd allow it anyways with '--trusted-host pypi.douban.com '.
  Could not find a version this satisfies the requirement requests (from versions:)
No matching distribution for Requests

This is because mirroring is not a reason for HTTPS.
For mirroring that supports HTTPS, it's better to have the URL changed to HTTPS.
For example

Pip Install-i https://pypi.mirrors.ustc.edu.cn/simple/requests

For mirrors that do not support HTTPS, I will be replaced with--trusted-host.
The order is as follows:

Pip install requests--trusted-host http://pypi.mirrors.ustc.edu.cn/simple/
pip install--trusted-host http:// Pypi.mirrors.ustc.edu.cn/simple/gevent 
Configure default Mirrors

If you do not want to specify mirroring each time, you can set the location of the profile configuration file

New version pip: $HOME/.config/pip/pip.conf
History remains a problem, $HOME/.pip/pip.conf also support
In virtual environments: $VIRTUAL _env/pip.conf
If the configuration file does not exist, create it yourself.

Updated March 16, 2017: I've found the PIP profile path for $home/.pip/pip.conf to Add code from the Aliyun Ubuntu 16.04 Server

[Global]
Timeout =
Index-url = https://pypi.tuna.tsinghua.edu.cn/simple
Reference

For more configuration, refer to official documentation:
https://pip.pypa.io//en/latest/user_guide/#configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.