Windows安装时出现wxPython导入错误
我已经在Windows 10上安装了Python 3.4和wxPython Phoenix.我进入Eclipse并将wxPython添加到项目中的外部库中,但是当我尝试导入它时,出现此错误:
I have installed Python 3.4 and wxPython Phoenix on Windows 10. I go into Eclipse and add wxPython to the external libs in my project, but when I try to import it, I get this error:
Traceback (most recent call last):
File "C:\Users\linus\workspace\MiCS 1.2\main.py", line 1, in <module>
import wx
File "C:\Python34\Lib\site-packages\wx\__init__.py", line 17, in <module>
from wx.core import *
File "C:\Python34\Lib\site-packages\wx\core.py", line 6, in <module>
from ._core import *
ImportError: DLL load failed: The specified module could not be found.
我进行了一些搜索和修改,但仍然不知道是什么原因造成的.它不应该是msvcp或msvcr DLL,因为我的Office运行得很好(或者这是一个不正确的假设吗?)可以提供任何帮助.谢谢.
I did some searching and tinkering and still can't figure out what's causing it. It shouldn't be the msvcp or msvcr DLLs as I have Office running just fine (or is that an incorrect assumption?) Any help is appreciated. Thanks.
您是如何安装wxpython的?
How did you install wxpython?
截至目前,官方网站的首页仅具有适用于python27的wxpython 3.0.因此,我怀疑您可能没有正确安装它.
As of now, the top page of the official site has wxpython 3.0 only for python27. So, I suspect you might not have installed it properly.
如果您的python34位于C:/Python34,那么首先将CD切换至C:/Python34/Scripts,以便我们确保对此python使用pip.
If you have your python34 at C:/Python34 then, cd to C:/Python34/Scripts first so that we make sure to use the pip for this python.
根据此帖子( https://groups.google.com/forum/#!topic/wxpython-dev/LmGIrQyh7jc ),请尝试
According to this post (https://groups.google.com/forum/#!topic/wxpython-dev/LmGIrQyh7jc), try
pip install -U --pre -f http://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix
这将为您的python版本和CPU体系结构找到相应的whl文件.
This should find the corresponding whl file for your python version and CPU architecture.
或者,您可以在 http://wxpython.org/Phoenix/snapshot-构建/
如果您拥有32位Python34,则查找******-cp34-none-win32.whl
If you have 32 bit Python34, then look for ******-cp34-none-win32.whl
只需执行以下操作即可:
and simply do:
pip安装路径/至/the/whl/that/you/just/downloaded/wxPython_Phoenix-3.0.3.dev1839+4ecd949-cp34-none-win32.whl
此后,如果您可以在常规cmd中 wx
导入,那么问题应该出在日食上.
After this, if you can import wx
in the normal cmd then the problem should be coming from eclipse.