问题
After upgrading pip from 1.4.x to 1.5 pip freeze
outputs a list of my globally installed (system) packages instead of the ones installed inside of my virtualenv. I've tried downgrading to 1.4 again but that does not solve my problem. It's somewhat similar to this question only it's been working as expected for months. Is there any way to debug and/or repair this?
It seems like the virtualenv has no effect at all. Installing packages within it installs them globally too.
回答1:
I had problems with pip installing packages globally instead of in the activated virtualenv too. Have a look at pip installing in global site-packages instead of virtualenv for the question (and the answer).
Basically, the solution consisted of modifying the shebang of the pip scripts within the virtualenv as they pointed to the wrong python installation.
回答2:
Even if you have installed properly, but with global site packages visible to your virtualenv
, still pip
will list everything, unless you use pip list --local
discussed here.
来源:https://stackoverflow.com/questions/21017012/pip-listing-global-packages-in-active-virtualenv