在 Windows XP 上安装 wxPython 后“import wx”失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/316325/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:39:16  来源:igfitidea点击:

"import wx" fails after installation of wxPython on Windows XP

pythonwindowswxpython

提问by Dave

I downloaded and installed this version of wxPythonfor use with my Python 2.6 installation:

我下载并安装了这个版本的wxPython以用于我的 Python 2.6 安装:

http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-2.8.9.1-py26.exe

http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-2.8.9.1-py26.exe

When I run Python and try to import wx, I get the following error:

当我运行 Python 并尝试导入 wx 时,出现以下错误:

C:\Program Files\Console2>python
Python 2.6 (r26:66721, Oct  2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\Python26\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.py", line 45, in <module>
    from wx._core import *
  File "c:\Python26\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 4, in <module>
    import _core_
ImportError: DLL load failed: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
>>>

I have already tried removing wxPython and installing again and I got the same error. How can I fix this problem?

我已经尝试删除 wxPython 并再次安装,但遇到了同样的错误。我该如何解决这个问题?

回答by chirag

I was getting the same error.

我遇到了同样的错误。

After some googling found this link to MSVC++ 2008 Redestributableand installed it.

经过一番谷歌搜索后,找到了指向MSVC++ 2008 可再发行组件的链接并安装了它。

That solved the problem.

那解决了问题。

回答by Benjamin

Hate to say this, but I had the same problem, and and import worked fine after a reboot.

讨厌这样说,但我遇到了同样的问题,并且在重新启动后导入工作正常。

回答by Benjamin

Copy the Microsoft C runtime library v.9 files and manifest. That is, msvcr90.dlland microsoft.vc90.crt.manifestfrom folder pythonto the folder wx, tha is, folder which contains failed to start DLLs.

复制 Microsoft C 运行时库 v.9 文件和清单。也就是说,msvcr90.dllmicrosoft.vc90.crt.manifest从文件python到文件夹WX,THA是,文件夹,其中包含未能启动的DLL。

Or install the Visual C++ 2008 Redistributable Package.

或者安装 Visual C++ 2008 Redistributable Package。

回答by PraveenMax

I too have the same issue.Better install "Portable Python" IDE which comes with some nice modules including wxPython .You can start coding GUI immediately without the need to download a separate wxPython.The link , http://www.portablepython.com/

我也有同样的问题。最好安装“便携式 Python”IDE,它带有一些不错的模块,包括 wxPython。您可以立即开始编写 GUI,而无需下载单独的 wxPython。链接, http://www.portablepython.com /

回答by Brian C. Lane

Try the ANSI version instead of the Unicode one. IIRC it needs to match the Python 2.6 install to work properly.

尝试使用 ANSI 版本而不是 Unicode 版本。IIRC 它需要匹配 Python 2.6 安装才能正常工作。

回答by torial

From looking for "application configuration is incorrect" in the wxPython trac system, the only reference that might make sense is a 64-bit vs 32-bit compatibility issue.

通过在wxPython trac 系统中查找“应用程序配置不正确” ,唯一可能有意义的参考是 64 位与 32 位兼容性问题。

Otherwise, I'd say Brian's answerof trying ANSI is pretty good.

否则,我会说布莱恩对尝试 ANSI的回答非常好。

BTW, if you try uninstalling again, make go into the site-packages folder and make sure all the wx and wxPython stuff is deleted.

顺便说一句,如果您再次尝试卸载,请进入 site-packages 文件夹并确保删除所有 wx 和 wxPython 内容。

回答by Eb Abadi

Maybe too late, but I had the same problem and solved that by downloading that from their own website: wxPython2.8-win64-unicode-py27 In my case it initially wanted to setup in somewhere else than my python folder. So I changed it to be in ../python27/Lib/SitePackages/ Then it worked properly.

也许为时已晚,但我遇到了同样的问题,并通过从他们自己的网站下载解决了这个问题:wxPython2.8-win64-unicode-py27 在我的情况下,它最初想在我的 python 文件夹之外的其他地方进行设置。所以我把它改成 ../python27/Lib/SitePackages/ 然后它工作正常。

I hope it helps.

我希望它有帮助。

回答by NickO

Another late answer, but I recently had issues (8/14) and my solution was to use the 32-bit instead of 64-bit wxPython version.

另一个迟到的答案,但我最近遇到了问题 (8/14),我的解决方案是使用 32 位而不是 64 位 wxPython 版本。

回答by kamzur

you try to use the module wxpython 2.8.12.1 version, select the version of your python. you can download it here:

您尝试使用模块 wxpython 2.8.12.1 版本,请选择您的python 版本。您可以在这里下载:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#wxpython

http://www.lfd.uci.edu/~gohlke/pythonlibs/#wxpython