简体   繁体   English

在自定义目录(Linux)中安装Python:PIP无法正常工作

[英]Python installation in custom directory (Linux): PIP not working

I have installed Python3.6.4 in a Linux machine, under a user directory, lets say /drive/username/Python3.6.4 我已经在用户目录下的Linux机器中安装了Python3.6.4,可以说/drive/username/Python3.6.4
I've setup my path and aliases, and Python is working properly (ie executing python3 puts me in the correct environment, which python3 produces: /drive/username/Python3.6.4/bin/python3 ) 我已经设置了路径和别名,并且Python运行正常(即执行python3使我处于正确的环境中, which python3会在该环境中生成: /drive/username/Python3.6.4/bin/python3

The problem is with pip ! 问题出在pip When i execute pip3 , i am getting: 当我执行pip3 ,我得到:
-bash: /username/Python3.6.4/bin/pip3: /usr/local/bin/python3.6: bad interpreter: No such file or directory

the command which pip3 gives: /drive/username/Python3.6.4/bin/pip3 which pip3给出的命令: /drive/username/Python3.6.4/bin/pip3

What am i missing? 我想念什么?

On my PC: 在我的电脑上:

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

So, I think your pip has shebang like #!/usr/local/bin/python3.6 . 因此,我认为您的pip具有#!/usr/local/bin/python3.6

Try rewrite or: 尝试重写或:

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

it will make correct pip in /drive/username/Python3.6.4/bin directory. 它将在/drive/username/Python3.6.4/bin目录中产生正确的pip

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM