gpt4 book ai didi

自定义目录中的 Python 安装 (Linux) : PIP not working

转载 作者:太空宇宙 更新时间:2023-11-04 10:12:08 25 4
gpt4 key购买 nike

我在 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: 错误的解释器:没有这样的文件或目录

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

我错过了什么?

最佳答案

在我的电脑上:

$ 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

关于自定义目录中的 Python 安装 (Linux) : PIP not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48417818/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com