有没有人遇到过同样的情况?
$ which pip
/usr/local/bin/pip
$pip
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip import main
ModuleNotFoundError: No module named 'pip'
$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip
>>> pip.__version__
'9.0.1'
其他包裹也发生了同样的情况
$ easy_install
Traceback (most recent call last):
File "/usr/local/bin/easy_install", line 7, in <module>
from setuptools.command.easy_install import main
ModuleNotFoundError: No module named 'setuptools'
$ virtualenv
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 7, in <module>
from virtualenv import main
ModuleNotFoundError: No module named 'virtualenv'
它们都已安装。
ubuntu 16.04 python 2
答案 0 :(得分:3)
为Ubuntu 10.10 Maverick及更新版
安装pip和virtualenv$ sudo apt-get install python-pip python-dev build-essential
$ sudo pip install --upgrade pip
$ sudo pip install --upgrade virtualenv
对于旧版本的Ubuntu
sudo apt-get install python-setuptools python-dev build-essential
sudo easy_install pip
$ sudo pip install --upgrade virtualenv
希望这会有所帮助..!