Installing the PIP tool

Source: Internet
Author: User

Python 2.7.9+ and 3.4+

Good news! Python 3.4 (released March) and Python 2.7.9 (released December) ship with Pip. The best feature of any Python release. It makes the community ' s wealth of libraries accessible to everyone. Newbies is no longer excluded from using community libraries by the prohibitive difficulty of setup. In shipping with a package manager, Python joins Ruby, Node.js,haskell, Perl, go--almost every other contemporary language With a majority Open-source community. Thank you Python.

Of course, that doesn ' t mean Python packaging is problem solved. The experience remains frustrating. I discuss this in Stack Overflow question Does Python has a package/module management system?.

And, alas for everyone using Python 2.7.8 or earlier (a sizable portion of the community). There ' s no plan to ship PIP to you. Manual instructions follow.

Python 2≤2.7.8 and Python 3≤3.3

Flying in the face of it ' batteries included ' motto, Python ships without a package manager. To make matters worse, Pip Was--until recently--ironically difficult to install.

Official instructions

Per https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip:

Download get-pip.py , being careful to save it as a .py file rather than .txt . Then, run it from the command prompt:

python get-pip.py

You possibly need a administrator command prompt to doing this. Follow Start a Command Prompt as an Administrator (Microsoft TechNet).

Alternative instructions

The official documentation tells users to install Pip and all of its dependencies from source. That's tedious for the experienced, and prohibitively difficult for newbies.

For we sake, Christoph Gohlke prepares Windows installers ( .msi ) for popular Python packages. He builds installers for all Python versions, both and the bit. You need to

    1. Install Setuptools
    2. Install pip

For me, this installed Pip at C:\Python27\Scripts\pip.exe . Find on pip.exe your computer, then add its folder (for example, C:\Python27\Scripts ) to your path (start/edit environment variables). N ow you should is able to run from the pip command line. Try Installing a package:

pip install httpie

There you go (hopefully)! Solutions for common problems is given below:

Proxy problems

If you are in the office, you might is behind a HTTP proxy. If So, set the environment variables http_proxy and https_proxy . Most Python applications (and other free software) respect these. Example Syntax:

http://proxy_url:porthttp://username:[email protected]_url:port

If you ' re really unlucky, your proxy might is a Microsoft NTLM proxy. Free software can ' t cope. The only solution-to-install a free software friendly proxy, forwards to the nasty PROXY.HTTP://CNTLM.SOURCEFORGE.N et/

Unable to find Vcvarsall.bat

Python modules can is part written in C or C + +. Pip tries to compile from source. If you don't have a C + + compiler installed and configured, you'll see this cryptic error message.

Error:unable to find Vcvarsall.bat

You can fix this by installing a C + + compiler such as MinGW or Visual C + +. Microsoft actually ship one specifically in Python. Or try Microsoft Visual C + + Compiler for Python 2.7.

Often though it ' s easier to check Christoph's site for your package.

Installing the PIP tool

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.