我已经安装了一些 python 包,我可以使用 IDLE 而不是通过命令 shell 窗口访问它们。
这是 IDLE 的输出:
Python 2.7.2+ (default, Oct 4 2011, 20:03:08)
[GCC 4.6.1] on linux2
Type "copyright", "credits" or "license()" for more information.
==== No Subprocess ====
>>> import whoosh
这是我终端的输出:
pradeep@ubuntu:~$ python
Python 2.7.2 (default, Nov 28 2011, 23:56:33)
[GCC 4.6.1] on linux3
Type "help", "copyright", "credits" or "license" for more information.
>>> import whoosh
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named whoosh
如何将终端 python 指向 IDLE python 包?为什么终端显示“linux3”而 IDLE 显示“linux2”?请帮我解决这个路径问题。谢谢。
更新1:
谢谢大家。正如你们大多数人所猜测的那样,我安装了两个不同的版本。
我的空闲路径显示
['/home/pradeep', '/usr/bin', '/usr/local/lib/python2.7/dist-packages/Whoosh-2.3.0-py2.7.egg', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-installer', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']
我的终端路径显示:
['', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux3', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages']
如何删除终端版本并在终端中安装 IDLE 版本?谢谢。
请您参考如下方法:
您正在运行两个不同的 Python 安装,一个日期为 10/4/2011,另一个日期为 11/28/2011。第二个没有安装 whoosh。
您的选择是:
查找 IDLE 使用的版本并从命令行运行它。要找到它,请打开 IDLE 并运行
import sys;打印 sys.executable。这将向您显示安装了软件包的版本的位置。或者您可以通过在命令行安装相同的包来增强您的命令行版本(即运行
python setup.py install来安装您想要加载的各种包.
