pip
is a replacement for easy_install
. But should I install pip
using easy_install
on Windows? Is there a better way?
相关问题
- How does the setup bootstrapper detect if prerequi
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
Installers
I've built Windows installers for both distribute and pip here (the goal being to use
pip
without having to either bootstrap witheasy_install
or save and run Python scripts):On Windows, simply download and install first
distribute
, thenpip
from the above links. Thedistribute
link above does contain stub.exe
installers, and these are currently 32-bit only. I haven't tested the effect on 64-bit Windows.Building on Windows
The process to redo this for new versions is not difficult, and I've included it here for reference.
Building
distribute
In order to get the stub
.exe
files, you need to have a Visual C++ compiler (it is apparently compilable with MinGW as well)Building
pip
PythonXY comes with
pip
included, among others.Updated at 2016 :
Pip
should already be included inPython 2.7.9+ or 3.4+
, but if for whatever reason it is not there, you can use the following one-liner.python get-pip.py
(If you are on Linux, usesudo python get-pip.py
)PS:
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
, forPython 3.3x
:C:\Python33 and C:\Python33\Scripts
, etc)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!
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.
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
.How to install pip:
pypm install pip