'从wx.core import *'ImportError:DLL加载失败:找不到模块

时间:2018-09-13 04:47:44

标签: python-3.x wxpython importerror dllimport

我是较新的使用wxPython的人,首先,我使用pip install wxPython命令安装wxPyhton:

pip install -U wxPython
Requirement already up-to-date: wxPython in c:\program files\python\python37\lib\site-packages (4.0.3)
Requirement already satisfied, skipping upgrade: six in c:\program files\python\python37\lib\site-packages (from wxPython) (1.11.0)
Requirement already satisfied, skipping upgrade: PyPubSub in c:\program files\python\python37\lib\site-packages (from wxPython) (4.0.0)

然后我尝试运行此代码以显示GUI窗口,并从wxPyhton示例获取源代码:

# set_size.py
import wx
class Example(wx.Frame):
    def __init__(self, parent, title):
        super(Example, self).__init__(parent, title=title, size=(350, 250))

def main():
    app = wx.App()
    ex = Example(None, title='Sizing')
    ex.Show()
    app.MainLoop()

if __name__ == '__main__':
    main()

但是我收到错误消息“ import的未定义变量:Frame”,接下来该怎么办?

Traceback (most recent call last):
  File "C:\Users\zz250147\git\python\Scraping\prototype\set_size.py", line 6, in <module>
    import wx
  File "C:\Program Files\Python\Python37\lib\site-packages\wx\__init__.py", line 17, in <module>
    from wx.core import *
  File "C:\Program Files\Python\Python37\lib\site-packages\wx\core.py", line 12, in <module>
    from ._core import *
ImportError: DLL load failed: Module not found.

1 个答案:

答案 0 :(得分:0)

安装Microsoft Visual C++ 2015 Redistributable Update 3后,错误消失了!