Reputation: 4646
With Python 3.7 on OS X I set up a virtual environment then
$ source venv/bin/activate
$ pip install numpy
$ which pip
pip is /Users/me/PycharmProjects/Test1/venv/bin/pip
(venv)
But rather than installing in the virtual environment numpy
is installed in
/usr/local/lib/python2.7
and numpy
doesn't appear in pip list
The issue occurs with both Python installed via the Python download or via brew
.
What possible settings could be causing the package to be installed in the wrong location.
Upvotes: 4
Views: 5095
Reputation: 23
I had this issue because I renamed the root directory of my project. Looking at the venv/bin/activate
script, I could see references to the old name.
Could probably fix it by hand, but I just deleted the venv folder and re-created it.
Upvotes: 2
Reputation: 85
What worked for me :
[global]
target=D:\Dropbox\online store\django\ve\lib\site-packages
3)after restarting venv, by using this command
python -m pip install <package name>
now I am able to install packages on my venv ( instead of being installed globally )
Upvotes: 2
Reputation: 4646
To answer my own question.
There was an invisible
~/.config/pip/pip.conf
file. That contained these lines:
[global]
target = /usr/local/lib/python2.7/site-packages
This file was a few years old, so I'm unsure how it got there but removing it resolved the issue.
Upvotes: 7