【问题标题】:Python installation in custom directory (Linux): PIP not working自定义目录中的 Python 安装 (Linux):PIP 不起作用
【发布时间】:2018-07-03 05:21:20
【问题描述】:

我已经在 Linux 机器上安装了 Python3.6.4,在用户目录下,比如说/drive/username/Python3.6.4
我已经设置了路径和别名,并且 Python 工作正常(即执行 python3 将我置于正确的环境中,which python3 产生:/drive/username/Python3.6.4/bin/python3

问题在于pip! 当我执行pip3 时,我得到:
-bash: /username/Python3.6.4/bin/pip3: /usr/local/bin/python3.6: bad interpreter: No such file or directory

命令which pip3 给出:/drive/username/Python3.6.4/bin/pip3

我错过了什么?

【问题讨论】:

    标签: python linux bash pip


    【解决方案1】:

    在我的电脑上:

    $ cat /usr/bin/pip3.6 
    #!/usr/bin/python
    ...
    

    所以,我认为你的 pip 有类似 #!/usr/local/bin/python3.6 的 shebang。

    尝试重写或:

    /drive/username/Python3.6.4/bin/python3 -m ensurepip

    它将在/drive/username/Python3.6.4/bin 目录中生成正确的pip

    【讨论】:

      猜你喜欢
      • 2018-02-14
      • 2017-04-27
      • 1970-01-01
      • 1970-01-01
      • 2021-04-28
      相关资源
      最近更新 更多