【发布时间】:2020-01-07 21:55:11
【问题描述】:
我正在按照本教程安装virtualenvwrapper
https://realpython.com/python-virtual-environments-a-primer/#managing-virtual-environments-with-virtualenvwrapper
但是,我就是无法正常工作。
当我执行pip install virtualenvwrapper --user 时,我收到以下警告。
Installing collected packages: virtualenv, pbr, six, stevedore, virtualenv-clone, virtualenvwrapper
WARNING: The script virtualenv is installed in '/Users/user1/Library/Python/2.7/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script pbr is installed in '/Users/user1/Library/Python/2.7/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script virtualenv-clone is installed in '/Users/user1/Library/Python/2.7/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
所以我在.bash_profile 中添加了以下内容,现在它可以找到包了。
"/Users/user1/Library/Python/2.7/bin:$PATH"
但是我只是不明白为什么在我的环境中这个额外的步骤是必要的,而其他人似乎对直接安装到 /local/bin 的包没有问题。
这些是我的 python2 和 pip 没有符号链接的地方。
admins-MacBook-Pro:~ user1$ which python
/usr/bin/python
admins-MacBook-Pro:~ user1$ which pip
/usr/local/bin/pip
问题
- 为什么我的
pip在/Users/user1/Library/Python/2.7/bin上安装东西,而大多数人似乎都可以使用/usr/local/bin/? - 有没有办法避免这个问题?如何干净地设置我的环境,以便所有软件包都安装在 /usr/local/bin 中?
【问题讨论】:
-
您需要使用
pip3(与您的其他问题一样)。pip指向 2.7。一旦通过初始设置,Virtualenvwrapper 就可以很好地工作。 -
@DaveStSomeWhere 抱歉没有解决问题。它只是将它安装在 3.7/bin