I have a local version of Python 3.4.1 and I can run python -m pip install
, but I'm unable to find the pip binary to run pip install
. What's the difference between these two?
相关问题
- 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
- Django __str__ returned non-string (type NoneType)
- Evil ctypes hack in python
They do exactly the same thing. In fact, the docs for distributing Python modules were just updated to suggest using
python -m pip
instead of thepip
executable, because it's easier to tell which version of python is going to be used to actually runpip
that way.Edit:
Here's some more concrete "proof", beyond just trusting my word and the bug report I linked :)
If you take a look at the
pip
executable script, it's just doing this:It's calling
load_entry_point
, which returns a function, and then executing that function. The entry point it's using is called'console_scripts'
. If you look at the entry_points.txt file forpip
(/usr/lib/python2.7/dist-packages/pip-1.5.4.egg-info/entry_points.txt on my Ubuntu machine), you'll see this:So the entry point returned is the
main
function in thepip
module.When you run
python -m pip
, you're executing the__main__.py
script inside thepip
package. That looks like this:And the
runner.run
function looks like this:As you can see, it's just calling the
pip.main
function, too. So both commands end up calling the samemain
function inpip/__init__.py
.