Pip使用virtualenv将软件包安装在错误的目录中 [英] Pip installs packages in the wrong directory with virtualenv
本文介绍了Pip使用virtualenv将软件包安装在错误的目录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在OS X上使用Python 3.7 然后我设置了一个虚拟环境
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)
但不是将其安装在虚拟环境中,而是将numpy
安装在
But rather than installing in the virtual environment numpy
is installed in
/usr/local/lib/python2.7
和numpy
没有出现在pip list
通过Python下载或brew
安装的Python均会出现问题.
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.
推荐答案
回答我自己的问题.
有一个看不见的
~/.config/pip/pip.conf
文件.包含以下几行:
[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.
这篇关于Pip使用virtualenv将软件包安装在错误的目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文