Python automatically installs third-party class libraries

Source: Internet
Author: User

Python in the use of the process will use a large number of third-party libraries, a manual to download, installation more cumbersome. You can configure a third-party mirror source and use PIP for automatic installation. It is recommended to choose the image source of watercress: http://pypi.douban.com/simple/

Installation introduction under Windows (My environment is Win7+python 2.7.12)

1. Check that the PIP is installed. Typically, the Python installation finishes automatically. The check method is as follows:

C:\python27\scripts>dir

The volume in drive C is the system

The serial number of the volume is 0000-0a6f

Directory of C:\Python27\Scripts

2017/01/08 09:52 <DIR>.

2017/01/08 09:52 <DIR>.

2016/12/05 23:29 89,448 Easy_install-2.7.exe

2016/12/05 23:29 89,448 Easy_install.exe

2017/01/08 09:52 89,420 pip.exe

2017/01/08 09:52 89,420 pip2.7.exe

2017/01/08 09:52 89,420 pip2.exe

5 Files 447,156 bytes

2 Directories 19,888,021,504 bytes available

1. Add the PIP path to the path variable for easy follow-up execution. You do not need to go to the PIP path at a time. The configuration method is as follows:

The system variable, environment variable, advanced system settings, properties----"Path", click "Edit", add;; C:\Python27\Scripts

The results are as follows:

cmd command to execute PIP, the following shows the configuration success. Ps:cmd window needs to exit login again

C:\users\administrator>pip

USAGE:PIP <command> [Options]

2. Get the HomePath variable and create the%homepath%\pip\pip.ini file. If there is no directory under the%homepath% directory, create the PIP directory and the Pip.ini file yourself

C:\users\administrator>set HomePath homepath=\users\administrator

3, add the relevant content and save in the Pip.ini file, add content as follows:

[Global] Index-url = http://pypi.douban.com/simple [Install] trusted-host = pypi.douban.com

4, Test. Automatically download and install the Pexpect class library. As follows

c:\users\administrator>pip Install pexpect collecting pexpect downloading http://pypi.doubanio.com/ Packages/5b/16/4859a0376be8b87bf3920b1f6e63b8a3c0ee42488babee07c87ca9316e03/pexpe CT-4.2.1-PY2.PY3-NONE-ANY.WHL (55kB) 100% |████████████████████████████████| 61kB 240kb/s collecting ptyprocess>=0.5 (from pexpect) downloading http://pypi.doubanio.com/packages/40/a5/ 184B46A3C986000196ABD077166B2536ACB2500009BEC95FEB9B8FC19828/PTYPR OCESS-0.5.1-PY2.PY3-NONE-ANY.WHL Installing Collected Packages:ptyprocess, Pexpect successfully installed Pexpect-4.2.1 ptyprocess-0.5.1

5, the installation is successful.

Python automatically installs third-party class libraries

Related Article

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.