Pip 全局安装不工作
Pip Global Install Not Working
我按照 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 "$@"
}
我按照 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 "$@"
}