【发布时间】:2019-09-30 11:45:16
【问题描述】:
我正在尝试在我不是 root 的远程 Linux 服务器上安装 pip3。当我输入时,我有 Python 2.7.15rc1 和 Python 3.6.7:
ls -la ~/.local/lib/python2.7/site-packages/
它按预期返回包,
drwx------ 2 user user 64 May 12 16:59 .
drwx------ 2 user user 64 May 7 15:58 ..
drwxrwxr-x 2 user user 4096 May 12 16:59 numpy
drwxrwxr-x 2 user user 4096 May 12 16:59 numpy-1.16.3.dist-info
drwxrwxr-x 2 user user 64 May 12 16:56 pip
drwxrwxr-x 2 user user 4096 May 12 16:56 pip-19.1.1.dist-info
ls -la ~/.local/lib/python3.5/site-packages/
I get:ls: cannot access '/home/.local/lib/python3.5/site-packages/': No such file or directory
我尝试重新安装 pip3:
~$ wget https://bootstrap.pypa.io/get-pip.py
....(connecting to ..., saving to .... , saved)
~$ python3 get-pip.py --user
Collecting pip
...
Successfully installed pip-19.1.1
~$ echo "PATH=\$PATH:~/.local/bin" >> ~/.bashrc
~$ source ~/.bashrc
~$ pip3 install numpy --user
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
ImportError: cannot import name 'main'
ps: .... 表示一些额外的书面材料
我该如何处理,我尝试安装一个虚拟环境,这是我得到的。
~$ pip install virtualenv --user
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip import main
ImportError: cannot import name main
【问题讨论】:
-
@jww 这些文章没有回答我的问题!