我正在使用Ubuntu 14.04,在我的计算机上安装了多个Python版本(包括python2.7和python3.4)。几天前,我在系统上安装了simplejson。我不记得我是怎么做的,但我想它肯定类似于pip install simplejson。然而,现在当我尝试安装任何Python包时,就开始出现奇怪的问题。例如,刚才我尝试使用sudo pip3.4 install Tkinter安装Tkinter时,它会抛出以下错误:
有时候,如果错误提示我在其中一个文件中有以下内容,我可以修复它:
我将其简单转换为
但是它仍然给我相同的错误:找不到json。请问有人能帮我修复这个问题,让我愉快地安装Python包吗?提前感谢您的帮助。
Traceback (most recent call last):
File "/usr/local/bin/pip3.4", line 9, in <module>
load_entry_point('pip==1.5.4', 'console_scripts', 'pip3.4')()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 351, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2363, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2088, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 61, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/lib/python3/dist-packages/pip/vcs/subversion.py", line 4, in <module>
from pip.index import Link
File "/usr/lib/python3/dist-packages/pip/index.py", line 15, in <module>
from pip.wheel import Wheel, wheel_ext
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 25, in <module>
from distlib.scripts import ScriptMaker
File "/usr/share/python-wheels/distlib-0.1.8-py2.py3-none-any.whl/distlib/scripts.py", line 15, in <module>
File "/usr/share/python-wheels/distlib-0.1.8-py2.py3-none-any.whl/distlib/resources.py", line 20, in <module>
File "/usr/share/python-wheels/distlib-0.1.8-py2.py3-none-any.whl/distlib/util.py", line 11, in <module>
ImportError: No module named 'json'
有时候,如果错误提示我在其中一个文件中有以下内容,我可以修复它:
import json
我将其简单转换为
import simplejson as json
我尝试卸载simplejson:
sudo pip uninstall simplejson
但是它仍然给我相同的错误:找不到json。请问有人能帮我修复这个问题,让我愉快地安装Python包吗?提前感谢您的帮助。
pip
安装的,为什么要尝试通过apt-get
卸载呢? - jonrsharpejson
是否仍然存在? - Tadhg McDonald-Jensen