我今天想使用pip
,但出现类似以下错误:
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
所以我以为我会purge
并重新install
(紧随https://www.rosehosting.com/blog/how-to-install-pip-on-ubuntu-16-04/之后),但仍然得到:
$ sudo apt-get install python-pip
[sudo] password for ron:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
docutils-common liblept5 libtesseract3 linux-headers-4.4.0-127 linux-headers-4.4.0-127-generic linux-image-4.4.0-127-generic linux-image-extra-4.4.0-127-generic python3-colorama python3-dateutil python3-docutils python3-jmespath python3-pygments python3-roman python3-rsa
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
python-pip
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 144 kB of archives.
After this operation, 633 kB of additional disk space will be used.
Get:1 http://ca.archive.ubuntu.com/ubuntu xenial/universe amd64 python-pip all 8.1.1-2 [144 kB]
Fetched 144 kB in 0s (162 kB/s)
Selecting previously unselected package python-pip.
(Reading database ... 667382 files and directories currently installed.)
Preparing to unpack .../python-pip_8.1.1-2_all.deb ...
Unpacking python-pip (8.1.1-2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up python-pip (8.1.1-2) ...
ron@regDesktopHome:~/docker$ pip -V
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
我如何设置点子并正确运行?
答案 0 :(得分:0)
我对docker不熟悉
尝试更改
from pip import main
到
from pip._internal import main
从pip 10开始不推荐使用pip.main
编辑
对不起,我想念您正在使用pip 8.1