可以在Ubuntu 11.4中启动许多Python程序



我最近开始使用Ubuntu。我是一个经验丰富的程序员,多年来一直在使用"旧"Python。但是,在Python 3.2中,当我试图运行我从中安装的几个不同程序中的一个时,例如,我收到了一条类似于下面粘贴的错误消息。

在这里,我正在尝试启动IPython。但这种错误也发生在其他人身上。

Traceback (most recent call last):
File "./ipython3", line 9, in <module>
load_entry_point('ipython==0.12', 'console_scripts', 'ipython3')()
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.24-py3.2.egg/pkg_resources.py", line 337, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.24-y3.2.egg/pkg_resources.py", line 2279, in load_entry_point
raise ImportError("Entry point %r not found" % ((group,name),))
ImportError: Entry point ('console_scripts', 'ipython3') not found

我在谷歌上搜索了这个错误,发现其他用户也有类似的问题,但据我所见,没有人报告真正的解决方案。

我的猜测是,您将distro安装与easy_installs混合在一起。

使用Python进行实验和工作的最好方法可能是使用一个单独的"沙箱"。使用virtualenv(这是几种方法之一),可以按如下方式进行:

$ virtualenv -p /usr/bin/python3.2 --distribute MYPYTHON32
Running virtualenv with interpreter /usr/bin/python3.2
New python executable in MYPYTHON32/bin/python3.2
Also creating executable in MYPYTHON32/bin/python
Installing distribute...

然后你可以安装任何你想玩的东西:

$ cd MYPYTHON32
$ bin/easy_install ipython

我没有问题:

$ bin/ipython3
Python 3.2 (r32:88445, Dec  8 2011, 15:26:58) 
Type "copyright", "credits" or "license" for more information.
IPython 0.12 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
In [1]:

virtualenv上的文档将为您提供更多提示。这种可能的安装方式不会干扰系统Python,并且您始终可以控制在沙箱中安装的内容。

最新更新