【发布时间】:2019-02-18 15:26:33
【问题描述】:
我在 Ubuntu 16.04 中使用 Python 3.7.2。我从默认的 Ubuntu 存储库安装了 python3-pip 包,apt 报告说我已经安装了 python3-pip 8.1.1-2ubuntu0.4(版本 8.1.1),但 pip3 确实不能正常工作。 pip3 -V 应该打印 pip3 版本,但它会返回 No module named 'pip'。
root@VM-0-8-ubuntu:/usr/bin# python -V
Python 3.7.2
root@VM-0-8-ubuntu:/usr/bin# pip3 -V
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
ModuleNotFoundError: No module named 'pip'
root@VM-0-8-ubuntu:/usr/bin# sudo apt-get install python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version (8.1.1-2ubuntu0.4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@VM-0-8-ubuntu:/usr/bin# pip3 -V
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
ModuleNotFoundError: No module named 'pip'
root@VM-0-8-ubuntu:/usr/bin# sudo apt updaate
E: Invalid operation updaate
root@VM-0-8-ubuntu:/usr/bin# sudo apt update
Hit:1 http://mirrors.tencentyun.com/ubuntu xenial InRelease
Hit:2 http://mirrors.tencentyun.com/ubuntu xenial-security InRelease
Ign:3 http://mirrors.aliyun.com/ubuntu trusty InRelease
Hit:4 http://mirrors.tencentyun.com/ubuntu xenial-updates InRelease
Hit:5 http://mirrors.aliyun.com/ubuntu trusty-security InRelease
Hit:6 http://mirrors.aliyun.com/ubuntu trusty-updates InRelease
Hit:7 http://mirrors.aliyun.com/ubuntu trusty-proposed InRelease
Hit:8 http://mirrors.aliyun.com/ubuntu trusty-backports InRelease
Hit:9 http://mirrors.aliyun.com/ubuntu trusty Release
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
root@VM-0-8-ubuntu:/usr/bin# sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@VM-0-8-ubuntu:/usr/bin# sudo apt-get install python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version (8.1.1-2ubuntu0.4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@VM-0-8-ubuntu:/usr/bin# pip3 -V
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
ModuleNotFoundError: No module named 'pip'
root@VM-0-8-ubuntu:/usr/bin#
【问题讨论】:
-
问题是什么?
标签: ubuntu pip python-3.7