我关注了this guide设置 Python 环境时,我在设置函数以绕过虚拟环境要求的部分遇到了麻烦。基本上,我希望 gpip install 在没有虚拟环境的情况下工作。也对实现这一目标的其他方法持开放态度。
这是我的 pip.conf 文件:
[install]
require-virtualenv = true
[uninstall]
require-virtualenv = true
这是我的 .bash_profile 文件:
1 # Ensure user-installed binaries take precedence
2 export PATH=/usr/local/bin:$PATH
3 # Load .bashrc if it exists
4 test -f ~/.bashrc && source ~/.bashrc
这是我的 .bashrc 文件:
1 gpip(){
2 PIP_REQUIRE_VIRTUALENV="" pip3 "$@"
3 }
我也尝试过
1 gpip(){
2 PIP_REQUIRE_VIRTUALENV="" pip "$@"
3 }
我还是明白
Could not find an activated virtualenv (required).
当我输入时
gpip install
最佳答案
您应该更改以下内容
gpip(){
PIP_REQUIRE_VIRTUALENV="" pip3 "$@"
}
至
gpip(){
PIP_REQUIRE_VIRTUALENV="false" pip3 "$@"
}
关于python - Pip 全局安装不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50243762/