问题
I like to figure out the myth behind Python's namespace packages by setuptools, and here is what I did test.
- Make a virtual environment by
virtualenv. - Find a namespaced package on PyPI.
- Install that package by
pip install. - Check the installed file hierarchy.
The package I played with is zope.interface and it worked well with the following file hierarchy on my virtualenv:
~virenv/.../site-packages/zope.interface-3.8.0-py2.6-nspkg.pth
/zope.interface-3.8.0-py2.6.egg-info/
/zope/
/interface/
/...
Everything looked fine and I love the way zope.interface got installed as a real namespaced package (under folder zope).
Then, I did another test and that's the question I would like to ask for your help. I downloaded the tared zope.interface source file. I liked to play it manually again
- Make a virtual environment by
virtualenv. - Untar the zope.interface into somewhere.
- Install the package by
python setup.py install. - Go check what happened in site-packages.
The site-packages looks like this:
~virenv/../site-packages/zope.interface-...egg/
/zope/
/__init__.py
/interface/
/EGG-INFO/
Q. How come I can't get the exactly result to pip install by manually python setup.py install?
回答1:
pip uses setup.py internally. It just passes additional option to it. To reproduce what pip is doing, execute
python setup.py install --single-version-externally-managed
You can also run pip -vv to see exactly which commands are run.
回答2:
Q. How come I can't get the exactly result to pip install by manually python setup.py install?
Because pip and setup.py are two different pieces of software.
pip is not advertised as providing identical behaviour to setup.py, nor vice versa.
If you want the behaviour of pip, use pip; if you want the behaviour of setup.py, use setup.py.
来源:https://stackoverflow.com/questions/10172286/how-come-i-cant-get-the-exactly-result-to-pip-install-by-manually-python-set