Python uses the PyPI Management Pack __python

Source: Internet
Author: User

Original address: http://www.omgdba.com/python-use-pypi-manage-packages.html

PyPI (Python pakkage index,http://pypi.python.org/pypi) is a Python public repository that manages Python-related brother feature packs. Anyone can log on to the home page to download Python's related package resources. Of course, for convenience, it also provides a software named Pip to work with Easy_install to manage package resources, with simple commands to install, update, and delete packages.

1. PIP Installation

The PIP works on Windows, Mac OS, Unix/linux, and other operating systems, but requires at least 2.6 + and 3.2+ CPython or pypy support.

The Python 2.7.9 and 3.4 versions have been built into the accrued PIP program, so no installation is required. Other versions can be installed using the following command:

1 2 3 4 5 6 #下载 https://Bootstrap. Pypa. Io/get-pip. PY #安装 (requires Administrator privileges under Linux) Python get-pip. Py #加入环境变量 (Windows) #将C: \python27 \scripts Join Path

For more installation methods please refer to: https://pip.pypa.io/en/latest/installing.html

2. Use of PIP

1 2 3 4 5 6 7 8 #安装包 $ pip Install somepackage # Latest version $ pip install somepackage = = 1.0.4 # Specify version $ pip install ' Somepacka ge>=1.0.4 ' # Minimum version #更新包 $ pip install-u samepackage #删除包 $ pip Uninstall somepackage

3. Use third party source to update

For some network reasons, the situation is not very stable when connecting to Pip's official website. Luckily there are a lot of mirror stations to use. We can use the mirror station to speed up the download. Mirror Station list: http://www.pypi-mirrors.org/

Using a mirrored source is simple, with-i specifies the line:
Easy_install-i http://pypi.douban.com/simple/gevent
Pip Install-i http://pypi.douban.com/simple/gevent

If you feel too troublesome, you can make the default:
Under Linux, modify ~/.pip/pip.conf, if not this file is created.
Under Windows, modify the%homepath%\pip\pip.ini.
Content is:
[Global]
Index-url = Http://pypi.douban.com/simple

The following error is reported in the new version on a mirror station that is not HTTPS transport:

This repository located at Mirrors.aliyun.com was not a trusted host, if this repository was available via HTTPS it is recom Mend to use HTTPS instead, otherwise your may silence this warning with ' –trusted-host mirrors.aliyun.com '.
Deprecation:implicitly allowing locations which are not hosted in a secure origin is deprecated and'll require the use Of–trusted-host in the future.
Requirement already UP-TO-DATE:PIP In/usr/lib/python2.7/site-packages

The solution is:

1 2 3 [Global] Trusted

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.