python - Pip 全局安装不起作用

标签 python pip package installation global

我关注了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/

相关文章:

python - Django "Models aren' t 已加载”

python - 用 m 种颜色给 n 个盒子着色

Python:如何获取elasticsearch查询的总命中数

python-3.x - 使用 pip 安装时出现 Transport_encoding 错误

r - lmer 对象中使用的 bootstrap() 函数

node.js - 模块 vs. 依赖 vs. 库 vs. 包 vs. 组件

linux - 跟踪和监控包或执行的文件事件?

python - 如何使 python 要求可移植?

使用 pip install 安装 tensorflow-gpu 时出现 SSL 错误

python - 在 CentOs 上安装 pygit2 时出错