链接wxpython来运行drpython
我想运行 drpython,但它找不到我安装的 wxpython 库:
C:\Users\Niklas\Desktop\DrPython>python drpython.pyw
Traceback (most recent call last):
File "drpython.pyw", line 35, in <module>
import drpython
File "C:\Users\Niklas\Desktop\DrPython\drpython.py", line 48, in <module>
import wx, wx.stc
ImportError: No module named wx
我该怎么解决这个问题?我使用 Windows 7,在 Ubuntu 上这是有效的。 我安装了wx,但python解释器找不到wx模块:
Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named wx
>>>
我的路径是
C:\Users\Niklas>echo %PATH%
C:\Program Files (x86)\ActiveState Komodo IDE 6\;C:\Windows\system32;C:\Windows;
C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program
Files (x86)\Hewlett-Packard\HP ProtectTools Security Manager\Bin\;C:\Program Fil
es (x86)\Intel\Services\IPT\;C:\Program Files\Mercurial\;C:\Program Files\Tortoi
seHg\;C:\python27\;C:\Program Files (x86)\Google\google_appengine\;C:\python27\L
ib\site-packages;C:\python27
我的sys.path是
>>> import sys
>>> sys.path
['', 'C:\\Windows\\system32\\python27.zip', 'C:\\python27\\DLLs', 'C:\\python27\
\lib', 'C:\\python27\\lib\\plat-win', 'C:\\python27\\lib\\lib-tk', 'C:\\python27
', 'C:\\python27\\lib\\site-packages']
>>>
I want to run drpython but it can't find the wxpython library that I installed:
C:\Users\Niklas\Desktop\DrPython>python drpython.pyw
Traceback (most recent call last):
File "drpython.pyw", line 35, in <module>
import drpython
File "C:\Users\Niklas\Desktop\DrPython\drpython.py", line 48, in <module>
import wx, wx.stc
ImportError: No module named wx
What can I do to resolve this? I use Windows 7 and on Ubuntu this is working.
I installed wx but the python interpreter can't find the wx module:
Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named wx
>>>
My path is
C:\Users\Niklas>echo %PATH%
C:\Program Files (x86)\ActiveState Komodo IDE 6\;C:\Windows\system32;C:\Windows;
C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program
Files (x86)\Hewlett-Packard\HP ProtectTools Security Manager\Bin\;C:\Program Fil
es (x86)\Intel\Services\IPT\;C:\Program Files\Mercurial\;C:\Program Files\Tortoi
seHg\;C:\python27\;C:\Program Files (x86)\Google\google_appengine\;C:\python27\L
ib\site-packages;C:\python27
My sys.path is
>>> import sys
>>> sys.path
['', 'C:\\Windows\\system32\\python27.zip', 'C:\\python27\\DLLs', 'C:\\python27\
\lib', 'C:\\python27\\lib\\plat-win', 'C:\\python27\\lib\\lib-tk', 'C:\\python27
', 'C:\\python27\\lib\\site-packages']
>>>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里相关的是 sys.path - 而不是环境 %PATH%。
例如:
如果您想从环境中影响 sys.path,则相关变量是 %PYTHONPATH%。
您还可以导入一个给定完整路径的模块 - 但它变得更棘手 - 请参阅
What's relevant here is sys.path - not the environment %PATH%.
E.g.:
If you want to influence sys.path from the environment, ther relevant variable is %PYTHONPATH%.
You can also import a module given it's full path - but it gets trickier - see this thread