Python / IPython ImportError:没有名为site的模块
我有 python 2.7.3
和 ipython 1.2
在我的上正确运行Linux
系统( ubuntu 12.04
)但是正在尝试安装课程作业所需的matplotlab的更新版本。
I had python 2.7.3
and ipython 1.2
up and running correctly on my Linux
system (ubuntu 12.04
) but was trying to install an updated version of matplotlab needed for coursework.
在终端中运行此代码行后
After running this code line in the terminal
user$ sudo easy_install -U distribute
user$ export PYTHONHOME=/usr/lib/python2.7/
现在我每次尝试运行 python
或 ipython
我收到错误消息
now every time I try and run python
or ipython
I get the error message
ImportError: no module named site
如何撤消/解决此问题? ?我迷路了。我看了其他类似的问题,但没有人使用 Linux
,我不知道该怎么做。
how do I reverse/fix this problem?? I'm so lost. I looked at other similar issues, but no one else used Linux
and I'm not sure what to do.
更改标准Python的位置库。默认情况下,
库在前缀/ lib / pythonversion和
exec_prefix / lib / pythonversion中搜索,其中prefix和exec_prefix是
依赖于安装的目录,两者都默认为/ usr / local。
Change the location of the standard Python libraries. By default, the libraries are searched in prefix/lib/pythonversion and exec_prefix/lib/pythonversion, where prefix and exec_prefix are installation-dependent directories, both defaulting to /usr/local.
当PYTHONHOME设置为单个目录时,其值将替换
前缀和exec_prefix。要为这些指定不同的值,请将
PYTHONHOME设置为前缀:exec_prefix。
When PYTHONHOME is set to a single directory, its value replaces both prefix and exec_prefix. To specify different values for these, set PYTHONHOME to prefix:exec_prefix.
尝试清理 PYTHONHOME
:
user$ export PYTHONHOME=
至于安装matplotlib,我建议如下:
As for installing matplotlib, I would recommend the following:
sudo apt-get install python-matplotlib
(详情其他)