我已经安装了wxPython,方法是按照这个answer的说明,在ubuntu14.04中使用以下命令
sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-doc wx2.8-examples wx2.8-headers wx2.8-i18n
一切都安装好了。在
但是当我在代码中执行import wx操作时,我得到了以下错误。在Python 2.7.6 (default, Mar 22 2014, 22:59:38)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named wx
在我的代码中使用wxPython需要安装什么吗?在
编辑:
安装wxPython的目录位于系统路径在
^{pr2}$
从上面的输出中我们可以看到它安装在/usr/lib/python2.7/dist-packages中,当我打印sys.path时,这个路径就包含在内了。在$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:38)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.path
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-i386-linux-gnu', '/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/PILcompat', '/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']
编辑2:
我还确保使用的python版本正确。在~$ which python
/usr/bin/python
~$ ll /usr/bin/python
lrwxrwxrwx 1 root root 9 Dec 21 2013 /usr/bin/python -> python2.7*
3986

被折叠的 条评论
为什么被折叠?



