By mit


2011-01-20 18:08:59 8 Comments

pip is a replacement for easy_install. But should I install pip using easy_install on Windows? Is there a better way?

30 comments

@Colonel Panic 2012-09-18 11:45:33

Python 2.7.9+ and 3.4+

Good news! Python 3.4 (released March 2014) and Python 2.7.9 (released December 2014) ship with Pip. This is the best feature of any Python release. It makes the community's wealth of libraries accessible to everyone. Newbies are 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 have 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 its '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 an administrator command prompt to do this. Follow Start a Command Prompt as an Administrator (Microsoft TechNet).

This installs the pip package, which (in Windows) contains ...\Scripts\pip.exe that path must be in PATH environment variable to use pip from the command line (see the second part of 'Alternative Instructions' for adding it to your PATH,

Alternative instructions

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

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

  1. Install setuptools
  2. Install pip

For me, this installed Pip at C:\Python27\Scripts\pip.exe. Find pip.exe on your computer, then add its folder (for example, C:\Python27\Scripts) to your path (Start / Edit environment variables). Now you should be able to run pip from the command line. Try installing a package:

pip install httpie

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

Proxy problems

If you work in an office, you might be behind an 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:port
http://username:[email protected]_url:port

If you're really unlucky, your proxy might be a Microsoft NTLM proxy. Free software can't cope. The only solution is to install a free software friendly proxy that forwards to the nasty proxy. http://cntlm.sourceforge.net/

Unable to find vcvarsall.bat

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

Error: Unable to find vcvarsall.bat

You can fix that by installing a C++ compiler such as MinGW or Visual C++. Microsoft actually ships one specifically for use with Python. Or try Microsoft Visual C++ Compiler for Python 2.7.

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

@Paul Draper 2013-04-14 17:47:45

Is that "can be fixed and will not be fixed" or "cannot be fixed and will not be fixed"?

@marshall 2013-05-14 20:07:31

I installed distribute and pip as above but now I get "error: Unable to find vcvarsall.bat" when I try to use pip.

@HelpingHand 2013-06-12 16:50:42

Wasn't distribute deprecated when setuptools arrived?

@HelpingHand 2013-06-12 16:54:19

From what I read here, PIP requires distribute (or at least is no good without it).

@user1063287 2013-06-15 10:00:42

distribute does not seem to be available anymore at url noted (lfd.uci.edu/~gohlke/pythonlibs/#distribute).

@user1063287 2013-06-15 10:33:42

for anyone wanting to know how to install distribute on windows, these were my steps (as installer above isn't available at the moment): start>accessories>windows powershell>windows powershell (right click and run as administrator) and then in powershell type PS C:\> python distribute_setup.py. when i tried to do this in standard cmd shell, it wouldn't allow me to write the files to disk, hence why i tried powershell as administrator and it worked.

@Mike McMahon 2013-06-27 21:57:24

note if you already have strawberry perl installed you won't be able to run pip install <module> until you've either removed strawberry perl or manually enter the path to python's pip!

@Colonel Panic 2013-06-27 22:00:22

@MikeMcMahon that happened to me too. Put Python before Perl in your path, so typing pip gets you the Python package manager.

@Mike McMahon 2013-06-28 17:18:53

@ColonelPanic thanks for that bit of info! I wonder though, will that cause any issues with Stawberry Perl?

@JuanPablo 2013-11-04 17:58:19

@CaptainCodeman 2013-11-10 19:50:24

I didn't have to do any of this, I just followed the instructions on pip-installer.org/en/latest/installing.html (basically you just write "python ez_setup.py" and then "python get-pip.py")

@Curtis Yallop 2014-03-11 16:57:07

Go to pip-installer.org/en/latest/installing.html run "python get-pip.py". It installed setuptools and pip in <10 seconds, no questions. C:\Python27\Scripts\pip.exe

@pitchblack408 2014-08-27 07:02:25

How do you install pip on windows for Jython? I downloading the installed and it isn't able to install on jython. I am using jython2.7b2

@Pavel Minaev 2014-10-03 22:38:50

Good news for those who run into vsvarsall.bat error message with Python 2.7! aka.ms/vcpython27

@Andrew 2015-07-14 16:39:44

This is probably a dumb question. I entered python get-pip.py on a windows prompt but get "python is not recognized as an internal or external command, operable program or batch file." Am I doing something wrong? I have Python 2.7.8 installed. Do I need to change the directory? Thanks.

@Colonel Panic 2015-07-14 17:47:00

@Andrew you need add eg. C:\Python27 to the system PATH (which is where the command prompt looks for programs), follow superuser.com/a/143121/62691

@Andrew 2015-07-16 14:38:25

That worked. It installed pip here: C:\Python27\ArcGIS10.3\Lib\site-packages. In Windows prompt I get 'pip is not a recognized as internal....." when I write 'pip help'. I tried adding C:\Python27 and C:\Python27\ArcGIS10.3\Lib\site-packages to the system PATH.

@Josie Thompson 2015-08-21 19:02:19

I'm reallly confused. I have python 2.7.10 and I get 'No module named pip' when I try to install something using 'python -m pip install arbitrary_mod_name' I also have no Scripts folder??

@powtac 2016-03-06 13:35:08

To start the "build in" pip you have to use python -m pip on windows!

@Kyle Delaney 2016-12-24 23:26:28

'pip' is not recognized as an internal or external command, operable program or batch file. I have Python 3.5 and I already ran python -m pip. How do I use the pip command?

@Parrybird 2017-06-29 07:17:04

My gotcha - I was running Python 3.2 which is not officially supported, but an alternative get-pip file is available at bootstrap.pypa.io/3.2/get-pip.py

@Alex 2018-08-21 00:57:09

Only the 32bit python 2.7 installer for windows worked for me.

@Dylan Hogg 2011-09-28 09:51:21

To install pip globally on Python 2.x, easy_install appears to be the best solution as Adrián states.

However the installation instructions for pip recommend using virtualenv since every virtualenv has pip installed in it automatically. This does not require root access or modify your system Python installation.

Installing virtualenv still requires easy_install though.

2018 update:

Python 3.3+ now includes the venv module for easily creating virtual environments like so:

python3 -m venv /path/to/new/virtual/environment

See documentation for different platform methods of activating the environment after creation, but typically one of:

$ source <venv>/bin/activate 

C:\> <venv>\Scripts\activate.bat

@Gringo Suave 2013-01-18 20:58:21

2016+ Update:

These answers are outdated or otherwise wordy and difficult.

If you've got Python 3.4+ or 2.7.9+, it will be installed by default on Windows. Otherwise, in short:

  1. Download the pip installer: https://bootstrap.pypa.io/get-pip.py
  2. If paranoid, inspect file to confirm it isn't malicious (must b64 decode).
  3. Open a console in the download folder as Admin and run get-pip.py. Alternatively, right-click its icon in Explorer and choose the "run as Admin...".

The new binaries pip.exe (and the deprecated easy_install.exe) will be found in the "%ProgramFiles%\PythonXX\Scripts" folder (or similar), which is likely not in your PATH variable. I recommend adding it.

@Ted Xu 2013-09-06 04:19:58

thanks, make sure you add PATH to your system variable

@Joris 2013-11-16 10:49:50

MD5 checksums of the files: get-pip.py=60a3d165e93999895e26b96681b65090 setuptools-1.3.2.tar.gz=441f2e58c0599d31597622a7b9eb605f

@matt wilkie 2014-02-04 20:08:38

As of pip 1.5.1 (Jan 2014) ez_setup/setuptools/distribute isn't needed ahead of time. If needed get-pip will acquire the requirements as well as pip itself.

@Dylan Hogg 2016-08-14 12:54:46

Good overview of python packaging past and present as of Aug 2016: glyph.twistedmatrix.com/2016/08/python-packaging.html

@Pedro Lobito 2018-03-11 01:34:24

Have you tried ?

python -m ensurepip

it's probably the easiest to install pip on any system.

@Usman Ahmed 2018-01-29 04:55:46

Now, it is bundled with Python. You don't need to install it.

pip -V

This is how you can check whether pip is installed or not. In rare case, if it is not installed, download get-pip.py file and run it with python as

python get-pip.py

@Janis Karklins 2017-09-15 05:49:02

Sometime it easier to understand when you use IDE:

  • Install PyCharm
  • And create virtual environment it will automatically install pip
  • Then in code you could install any python packages enter image description here

@Smaillns 2017-06-14 18:42:19

if you even have other problems with pip version you can try this

pip install --trusted-host pypi.python.org --upgrade pip

@danielad 2017-06-08 13:32:39

For latest Python Download - I have python 3.6 on windows. You don't have to wonder everything you need is there , take a breath i will show you how to do it.

  1. make sure where you install python for me its was in the following directory enter image description here

Now , lets add python and pip into environment variable path settings if you are on windows, so that typing pip or python anywhere call python aor pip from where they are installed.

So, PIP is found under the folder in above screen "SCRIPTS" Lets add Python and PIP in environment variable path. enter image description here

Almost Done , Let test with CMD to install goole package using pip.

pip install google

enter image description here

BYE BYE!

@Christian Tremblay 2015-06-30 23:35:49

I use the cross-platform Anaconda package manager from continuum.io on Windows and it is reliable. It has virtual environment management and a fully featured shell with common utilities (e.g. conda, pip).

> conda install <package>               # access distributed binaries

> pip install <package>                 # access PyPI packages 

conda also comes with binaries for libraries with non-Python dependencies, e.g. pandas, numpy, etc. This proves useful particularly on Windows as it can be hard to correctly compile C dependencies.

@RayLuo 2012-11-22 02:25:07

Updated at 2016 : Pip should already be included in Python 2.7.9+ or 3.4+, but if for whatever reason it is not there, you can use the following one-liner.

PS:

  1. This should already be satisfied in most cases but, if necessary, be sure that your environment variable PATH includes Python's folders (for example, Python 2.7.x on Windows default install: C:\Python27 and C:\Python27\Scripts, for Python 3.3x: C:\Python33 and C:\Python33\Scripts, etc)

  2. I encounter same problem and then found such perhaps easiest way (one liner!) mentioned on official website here: http://www.pip-installer.org/en/latest/installing.html

Can't believe there are so many lengthy (perhaps outdated?) answers out there. Feeling thankful to them but, please up-vote this short answer to help more new comers!

@Gringo Suave 2013-01-18 20:58:57

I believe you'll still need distribute or setuptools.

@joshuanapoli 2013-03-06 17:52:39

On my system, I also needed to add C:\Python33\Scripts to the PATH.

@flywire 2018-05-28 07:09:19

You forgot to mention you don't have firewall issues

@Dawid Ferenczy 2014-06-04 16:50:23

There is also an issue with pip on 64 bit Cygwin. After installation, the output of pip command is always empty, no matters what commands/options do you use (even pip -V doesn't produce any output).

If it's your case, just install the development version of Cygwin's package libuuid called libuuid-devel. Without that package using of libuuid causes a segfault. And pip uses that package, so the segfault is the cause of an empty output of pip on Cygwin x64. On 32 bit Cygwin it's working fine even without that package.

You can read some details there: https://github.com/kennethreitz/requests/issues/1547

@Pawanvir singh 2016-08-29 07:37:44

you have to get the get_pip.py file search it on google copy from there and save it locally in c drive in pip directory

@Chetan Sharma 2016-08-09 13:01:00

pip is already installed if you're using Python 2 >=2.7.9 or Python 3 >=3.4 binaries downloaded from python.org, but you'll need to upgrade pip.

On Windows upgrade can be done easily

Go to Python command line and run below Python command

python -m pip install -U pip

Installing with get-pip.py

Download get-pip.py in the same folder or any other folder of your choice. I am assuming you will download it in the same folder from you have python.exe file and run this command

python get-pip.py

Pip's installation guide is pretty clean and simple.

Using this you should be able to get started with Pip in under two minutes.

@Harun ERGUL 2016-03-29 07:07:44

Here how to install pip with easy way.

  1. copy and paste these content in a file as get-pip.py
  2. copy and paste get-pip.py into python folder.C:\Python27
  3. Double click to get-pip.py file.it will install pip to your computer.
  4. Now you have to add C:\Python27\Scripts path to your enviroment variable.Because it includes pip.exe file.
  5. Now you are ready to use pip. Open cmd and type as
    pip install package_name

@Kuruwan 2014-02-08 14:41:21

The following works for Python 2.7. Save this script and launch it:

https://raw.github.com/pypa/pip/master/contrib/get-pip.py

Pip is installed, then add the path to your environment :

C:\Python27\Scripts

Finally

pip install virtualenv

Also you need Microsoft Visual C++ 2008 Express to get the good compiler and avoid these kind of messages when installing packages:

error: Unable to find vcvarsall.bat

If you have a 64-bit version of Windows 7, you may read 64-bit Python installation issues on 64-bit Windows 7 to successfully install the Python executable package (issue with registry entries).

@swapnil gandhi 2018-11-29 05:36:12

link not working. please update it

@Paul Sweatte 2014-03-05 21:42:36

How to install pip:

  1. Download and install ActivePython
  2. Open a command prompt (CMD)
  3. Type pypm install pip

@sk8asd123 2014-02-25 16:41:15

Alternatively, you can get pip-Win which is an all-in-one installer for pip and virtualenv on Windows and its GUI.

  • Switch from one Python interpreter (i.e. version) to another (including py and pypy)
  • See all installed packages, and whether they are up-to-date
  • Install or upgrade a package, or upgrade pip itself
  • Create and delete virtual environments, and switch between them
  • Run the IDLE or another Python script, with the selected interpreter

@praveenak 2014-02-04 08:00:45

Working as of Feb 04 2014 :):

If you have tried installing pip through the Windows installer file from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pip as suggested by @Colonel Panic, you might have installed the pip package manager successfully, but you might be unable to install any packages with pip. You might also have got the same SSL error as I got when I tried to install Beautiful Soup 4 if you look in the pip.log file:

Downloading/unpacking beautifulsoup4
  Getting page https://pypi.python.org/simple/beautifulsoup4/
  Could not fetch URL https://pypi.python.org/simple/beautifulsoup4/: **connection error: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed**
  Will skip URL https://pypi.python.org/simple/beautifulsoup4/ when looking for download links for beautifulsoup4

The problem is an issue with an old version of OpenSSL being incompatible with pip 1.3.1 and above versions. The easy workaround for now, is to install pip 1.2.1, which does not require SSL:

Installing Pip on Windows:

  1. Download pip 1.2.1 from https://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz
  2. Extract the pip-1.2.1.tar.gz file
  3. Change directory to the extracted folder: cd <path to extracted folder>/pip-1.2.1
  4. Run python setup.py install
  5. Now make sure C:\Python27\Scripts is in PATH because pip is installed in the C:\Python27\Scripts directory unlike C:\Python27\Lib\site-packages where Python packages are normally installed

Now try to install any package using pip.

For example, to install the requests package using pip, run this from cmd:

pip install requests

Whola! requests will be successfully installed and you will get a success message.

@CaptainCodeman 2013-11-10 19:51:44

It's very simple:

Step 1: wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
Step 2: wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
Step 2: python ez_setup.py
Step 3: python get-pip.py

(Make sure your Python and Python script directory (for example, C:\Python27 and C:\Python27\Scripts) are in the PATH.)

@Dejell 2013-12-15 10:19:44

I don't see scripts folder on my machine I am using python 3.3

@thegauraw 2013-04-10 02:05:31

To use pip, it is not mandatory that you need to install pip in the system directly. You can use it through virtualenv. What you can do is follow these steps:

We normally need to install Python packages for one particular project. So, now create a project folder, let’s say myproject.

  • Copy the virtualenv.py file from the decompressed folder of virtualenv, and paste inside the myproject folder

Now create a virtual environment, let’s say myvirtualenv as follows, inside the myproject folder:

python virtualenv.py myvirtualenv

It will show you:

New python executable in myvirtualenv\Scripts\python.exe
Installing setuptools....................................done.
Installing pip.........................done.

Now your virtual environment, myvirtualenv, is created inside your project folder. You might notice, pip is now installed inside you virtual environment. All you need to do is activate the virtual environment with the following command.

myvirtualenv\Scripts\activate

You will see the following at the command prompt:

(myvirtualenv) PATH\TO\YOUR\PROJECT\FOLDER>pip install package_name

Now you can start using pip, but make sure you have activated the virtualenv looking at the left of your prompt.

This is one of the easiest way to install pip i.e. inside virtual environment, but you need to have virtualenv.py file with you.

For more ways to install pip/virtualenv/virtualenvwrapper, you can refer to thegauraw.tumblr.com.

@h--n 2013-03-25 23:46:21

The best way I found so far, is just two lines of code:

curl http://python-distribute.org/distribute_setup.py | python
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python

It was tested on Windows 8 with PowerShell, Cmd, and Git Bash (MinGW).

And you probably want to add the path to your environment. It's somewhere like C:\Python33\Scripts.

@Gringo Suave 2013-03-29 21:37:49

Curl isn't shipped with windows.

@h--n 2013-03-30 17:24:00

@GringoSuave Curl is so commonly used, everyone should have it. If that's not preferred, these two scripts can be just downloaded with any browser directly.

@matt wilkie 2013-04-16 05:04:28

Combine this with @Fernando's answer, stackoverflow.com/a/15294806/14420, for how to do the same without curl.

@charles ross 2013-11-02 02:53:01

Install GitHub for Windows and it customizes your Powershell with many goodies, such as curl.

@Fernando Macedo 2013-03-08 13:13:17

Update March 2015

Python 2.7.9 and later (on the Python 2 series), and Python 3.4 and later include pip by default, so you may have pip already.

If you don't, run this one line command on your prompt (which may require administrator access):

python -c "exec('try: from urllib2 import urlopen \nexcept: from urllib.request import urlopen');f=urlopen('https://bootstrap.pypa.io/get-pip.py').read();exec(f)"

It will install pip. If Setuptools is not already installed, get-pip.py will install it for you too.

As mentioned in comments, the above command will download code from the Pip source code repository at GitHub, and dynamically run it at your environment. So be noticed that this is a shortcut of the steps download, inspect and run, all with a single command using Python itself. If you trust Pip, proceed without doubt.

Be sure that your Windows environment variable PATH includes Python's folders (for Python 2.7.x default install: C:\Python27 and C:\Python27\Scripts, for Python 3.3x: C:\Python33 and C:\Python33\Scripts, and so on).

@Gringo Suave 2013-03-29 21:48:36

This should work, but it is worth noting that this could be extremely dangerous if one doesn't have the expertise or bother to inspect the url-file before executing such a command.

@Fernando Macedo 2013-04-01 20:08:47

I think the simplicity is worth the risk. We are talking about a hack at python-distribute.org? There is a similar approach with sublime package control.

@Gringo Suave 2013-04-03 07:46:46

Yes, I have checked the distribute URL and it is ok (for now at least). The problem is in the general case where the inexperienced run remote executables on recommendation from a forum. It should come at least with a minimal warning.

@Fernando Macedo 2013-04-03 17:36:07

I agree with you, the real issue is for who execute arbitrary code after read a post. The question is: can you trust me? I'll update the answer to notify the flow of actions being executed. I think that up/down votes can be used as "trust filter" too.

@matt wilkie 2013-04-16 07:15:54

Here's a pure python adaptation of @h--n answer which uses curl, and the urlib example above by Fernando. It attempts to adapt to py2 or 3 and issues a usage warning about executing arbitrary code: gist.github.com/maphew/5393935

@matt wilkie 2014-02-03 19:43:58

as of pip 1.5.1 distribute_setup is no longer required. So now the answer is just "download get-ip.py and run python get-pip.py"

@user1233104 2012-02-25 23:15:47

I just wanted to add one more solution for those having issues installing setuptools from Windows 64-bit. The issue is discussed in this bug on python.org and is still unresolved as of the date of this comment. A simple workaround is mentioned and it works flawlessly. One registry change did the trick for me.

Link: http://bugs.python.org/issue6792#

Solution that worked for me...:

Add this registry setting for 2.6+ versions of Python:

 [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.6\InstallPath]
 @="C:\\Python26\\"

This is most likely the registry setting you will already have for Python 2.6+:

 [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\InstallPath]
 @="C:\\Python26\\"

Clearly, you will need to replace the 2.6 version with whatever version of Python you are running.

@AndrewPK 2012-01-27 18:43:14

2014 UPDATE:

1) If you have installed Python 3.4 or later, pip is included with Python and should already be working on your system.

2) If you are running a version below Python 3.4 or if pip was not installed with Python 3.4 for some reason, then you'd probably use pip's official installation script get-pip.py. The pip installer now grabs setuptools for you, and works regardless of architecture (32-bit or 64-bit).

The installation instructions are detailed here and involve:

To install or upgrade pip, securely download get-pip.py.

Then run the following (which may require administrator access):

python get-pip.py

To upgrade an existing setuptools (or distribute), run pip install -U setuptools

I'll leave the two sets of old instructions below for posterity.

OLD Answers:

For Windows editions of the 64 bit variety - 64-bit Windows + Python used to require a separate installation method due to ez_setup, but I've tested the new distribute method on 64-bit Windows running 32-bit Python and 64-bit Python, and you can now use the same method for all versions of Windows/Python 2.7X:

OLD Method 2 using distribute:

  1. Download distribute - I threw mine in C:\Python27\Scripts (feel free to create a Scripts directory if it doesn't exist.
  2. Open up a command prompt (on Windows you should check out conemu2 if you don't use PowerShell) and change (cd) to the directory you've downloaded distribute_setup.py to.
  3. Run distribute_setup: python distribute_setup.py (This will not work if your python installation directory is not added to your path - go here for help)
  4. Change the current directory to the Scripts directory for your Python installation (C:\Python27\Scripts) or add that directory, as well as the Python base installation directory to your %PATH% environment variable.
  5. Install pip using the newly installed setuptools: easy_install pip

The last step will not work unless you're either in the directory easy_install.exe is located in (C:\Python27\Scripts would be the default for Python 2.7), or you have that directory added to your path.

OLD Method 1 using ez_setup:

from the setuptools page --

Download ez_setup.py and run it; it will download the appropriate .egg file and install it for you. (Currently, the provided .exe installer does not support 64-bit versions of Python for Windows, due to a distutils installer compatibility issue.

After this, you may continue with:

  1. Add c:\Python2x\Scripts to the Windows path (replace the x in Python2x with the actual version number you have installed)
  2. Open a new (!) DOS prompt. From there run easy_install pip

@nicolas 2012-08-27 09:54:49

So the install is easyinstall, then pip, then virtualenv, then virtualenvwrapper , then configure independents environments. with script modif in the middle for dealing with proxies... aaarrrgg

@AndrewPK 2012-10-16 19:30:35

@nicolas Yeah, easyinstall is just an outdated interface to setuptools. Pip is awesome, and virtualenv offers the kind of control that you don't get in many other languages without WAY more hackish tactics; perl being the only comparable exception. Ruby has gemsets, but in order to easily swap out Rubies, it's recommended to use either rbenv or rvm - both of which have always felt somewhat hackish to me (though they work beautifully once set up properly).

@user474491 2012-12-24 21:40:41

This exact procedure is automated by pip for windows.

@dbjohn 2012-12-29 22:11:28

+1, help note for noobs like me: don't type "python2x" literally in the windows path environment variable. Replace x with the python version you have, e.g. python27

@Mouseroot 2014-05-20 02:02:50

Id like to note, i had to use 'python -m pip' to use the module in windows.

@Dmitry Rubanovich 2015-12-20 23:12:41

I think the question makes it seem like the answer is simpler than it really is. Running of pip will sometimes require native compilation of a module (64-bit Numpy is a common example of that). In order for pip's compilation to succeed, you need Python which was compiled with the same version of MSVC as the one pip is using. Standard Python distributions are compiled with MSVC 2008. You can install an Express version of VC2008, but it is not maintained. Your best bet is to get an express version of a later MSVC and compile Python. Then PIP and Python will be using the same MSVC version.

@MattDMo 2016-01-14 02:25:13

that doesn't have anything to do with pip, but it has everything to do with how your development environment is set up, including which environment variables point where, and whether everything is on your PATH. Yes, your version of MSVC needs to match the one used to compile Python, but pip is just using what's in the environment.

@Dmitry Rubanovich 2016-01-14 02:31:37

@MattDMo, generally when people ask a question about how to install a package manager, that means they want to know how to also configure it (and its running environment) so that it can install packages. Most people run into trouble when trying to install numpy with PIP because they have a later version of MSVC installed and after pip pulls in the numpy sources, setup.py can't compile it. I stand by my answer.

@ybdesire 2015-05-05 06:13:35

Just download setuptools-15.2.zip (md5), from here https://pypi.python.org/pypi/setuptools#windows-simplified , and run ez_setup.py.

@Adil Abbasi 2014-09-24 05:39:11

  1. Download script: https://raw.github.com/pypa/pip/master/contrib/get-pip.py
  2. Save it on drive somewhere like C:\pip-script\get-pip.py
  3. Navigate to that path from command prompt and run " python get-pip.py "

Guide link: http://www.pip-installer.org/en/latest/installing.html#install-pip

Note: Make sure scripts path like this (C:\Python27\Scripts) is added int %PATH% environment variable as well.

@matth 2014-01-17 09:58:34

Python 3.4, which was released in March 2014, comes with pip included:
http://docs.python.org/3.4/whatsnew/3.4.html
So since the release of Python 3.4, the up-to-date way to install pip on Windows is to just install Python. When sticking to all defaults during installation, pip will be installed to
C:\Python34\Scripts\pip3.exe.

@Roberto 2015-12-08 15:25:00

Note that it also applies to Python 2.7.9

@matth 2015-12-09 09:18:38

Python 2.x is legacy, Python 3.x is the present and future of the language, according to Python2orPython3

@annena 2016-01-20 09:30:49

Hmm I installed Python 3.4.4 and I could find pip3.exe following the path in this answer, but in cmd pip is still not recognized. Can anyone help?

@matth 2016-01-20 11:24:55

In a command prompt, cd to the directory where pip3.exe resides and execute for example pip3 install -U sphinx.

@IgorGanapolsky 2016-03-21 04:22:12

Makes no sense. I installed Python 3.5.1 and still cannot run pip.

@jkt123 2017-05-19 13:13:30

@IgorGanapolsky New versions of Python come with pip installed as a module, and not as an installed executable (at least at the path listed). With Windows 10 and Python 3.6.1, I used py -m pip install xxx from the Windows command-prompt successfully.

@Adrián Deccico 2011-02-07 12:21:55

-- Outdated -- use distribute, not setuptools as described here. --
-- Outdated #2 -- use setuptools as distribute is deprecated.

As you mentioned pip doesn't include an independent installer, but you can install it with its predecessor easy_install.

So:

  1. Download the last pip version from here: http://pypi.python.org/pypi/pip#downloads
  2. Uncompress it
  3. Download the last easy installer for Windows: (download the .exe at the bottom of http://pypi.python.org/pypi/setuptools ). Install it.
  4. copy the uncompressed pip folder content into C:\Python2x\ folder (don't copy the whole folder into it, just the content), because python command doesn't work outside C:\Python2x folder and then run: python setup.py install
  5. Add your python C:\Python2x\Scripts to the path

You are done.

Now you can use pip install package to easily install packages as in Linux :)

@Yoo Matsuo 2011-05-05 04:04:58

When run the command "python setup.py install", if you got "error: pip.egg-info\PKG-INFO: Permission denied", then try to remove the read only attribute on the uncompressed pip directory.

@Chris 2011-06-27 17:18:47

If you install a 64-bit version of python, setuptools will not detect your python executable. I found some binaries here that will, though (unofficial): lfd.uci.edu/~gohlke/pythonlibs

@Mridang Agarwalla 2011-08-20 07:40:48

Once I've installed pip using easy_install can I remove setuptools by pip uninstall setuptools? Is this okay or would it lead to issues later on?

@powtac 2011-12-13 15:09:28

For Win 64, you can download peak.telecommunity.com/dist/ez_setup.py. Open pythonwin as Adminstrator and execute it. After that open the windows command line also as Admin and do step 4 and 5.

@Chelonian 2012-03-23 02:20:55

I did this and then tried to use "pip install package" at the DOS prompt and got "pip is not recognized as an internal or external command, operable program or batch file."

@Adrián Deccico 2012-03-27 02:40:35

@Chelonian seems like pip command is not in the path. Check step 5 and remember you have to start a new command window after modifying the path. Also restarting your computer will help.

@Elliot Cameron 2012-07-05 16:15:14

On Windows 64-bit, you have to fix the Python installation. Copy all of the HKEY_LOCAL_MACHINE\SOFTWARE\Python registry key into the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node key. You can do this by exporting the Python key, modifying the paths, and merging it back in.

@Jitendra Vyas 2012-08-06 17:57:13

go to the uncompressed pip directory and: python setup.py install where to type this command python setup.py install

@Derek Veit 2012-11-09 23:57:28

You do not need to copy the pip folder content into your c:\python2x folder as described in step 4. You can just add c:\python2x to your PATH environment variable or otherwise just use the full path when running python.

@Camilo Martin 2013-01-08 23:04:04

@JitendraVyas on the command line, where else?

@Pyderman 2013-02-28 16:47:17

As an alternative to step 4, simply run setup.py from wherever pip was dowloaded to e.g. from firefox C:\Users\Tony\Downloads\pip-1.2.1\pip-1.2.1

@gaborous 2016-01-30 16:28:38

This method still works very well as of 02/2016 to install pip (and then nose!) on Python 2.6 on Windows. Indeed, using Gohlke's binaries is no longer an option since he replaced them all by wheels.

@Martin Redola 2013-04-12 08:49:11

The up-to-date way is to use Windows' package manager Chocolatey.

Once this is installed, all you have to do is open a command prompt and run the following the three commands below, which will install Python 2.7, easy_install and pip. It will automatically detect whether you're on x64 or x86 Windows.

cinst python
cinst easy.install
cinst pip

All of the other Python packages on the Chocolatey Gallery can be found here.

@DevPlayer 2013-04-17 08:20:39

And if python is already installed? This caused me nightmares. With python already installed via other means and trying cinst pip just game me errors.

@fatuhoku 2013-10-23 10:48:54

Chocolatey doesn't seem very robust especially wrt. dependencies. cinst pip at the time of writing just assumes easy_install has been installed, which is not necessarily the case.

@IsmailS 2014-01-03 14:41:58

didn't worked for me :(

@Philipp 2014-01-16 12:23:32

I've edited the question, to make it work you'll need to have easy_install before you get pip, you can just do cinst easy.install

@Asken 2014-01-16 12:26:31

@Philipp, someone in their infinite wisdom unfortunately rejected that edit...

@drobison 2014-04-28 00:00:55

I had trouble with this at first. I think you need to make sure you: 1: Setup your environment path: stackoverflow.com/a/6318188/1674958 2: Restart your command prompt after each command if you run into issues.

@Kevin Driedger 2016-01-28 04:02:23

Just tried it. "cinst easy.install" fails but "cinst pip" installs easy.install. BTW, Windows 10.

@IgorGanapolsky 2016-03-21 04:28:10

@Philipp If you run cinst pip, it will automatically invoke easy.install

@Lars 2018-06-10 11:29:35

Just installed 'python3' using chocolatery and it included pip by default.

Related Questions

Sponsored Content

9 Answered Questions

[SOLVED] Installing specific package versions with pip

23 Answered Questions

[SOLVED] Homebrew install specific version of formula?

10 Answered Questions

[SOLVED] Find which version of package is installed with pip

  • 2012-04-18 17:37:20
  • Alexis
  • 403291 View
  • 522 Score
  • 10 Answer
  • Tags:   python pip

21 Answered Questions

[SOLVED] How do I install pip on macOS or OS X?

21 Answered Questions

[SOLVED] Check if a given key already exists in a dictionary

  • 2009-10-21 19:05:09
  • Mohan Gulati
  • 2653609 View
  • 2528 Score
  • 21 Answer
  • Tags:   python dictionary

51 Answered Questions

[SOLVED] Upgrading all packages with pip

  • 2010-04-27 09:23:25
  • thedjpetersen
  • 910944 View
  • 1595 Score
  • 51 Answer
  • Tags:   python pip

9 Answered Questions

[SOLVED] Why use pip over easy_install?

16 Answered Questions

[SOLVED] How to make a chain of function decorators?

20 Answered Questions

[SOLVED] How to install pip with Python 3?

16 Answered Questions

[SOLVED] Find all packages installed with easy_install/pip?

Sponsored Content