(PYTHON_GUI)WxPython安装 PYTHON-PIP-WX

一、环境:python34 win64 

二、安装方式两种:1、cmd >>cd c:\python34\scripts >>pip install wx下载地址

2、或将wx的wh1文件下载>>放入.python34/scripts里>>再pip install 文件名(√)

三、wx下载地址:https://pypi.python.org/pypi/wxPython/文件名  (√)

https://wxpython.org/Phoenix/snapshot-builds/

https://extras.wxpython.org/wxPython4/extras/

[下载注意版本匹配,比如 wxPython-4.0.0a4.dev3182+a7b9b02-cp35-cp35m-win32.whl  是win32的Python3.5版本的wxpython]

四、出现问题 

1、PIP版本太旧,如下图

(PYTHON_GUI)WxPython安装 PYTHON-PIP-WX(PYTHON_GUI)WxPython安装 PYTHON-PIP-WX(PYTHON_GUI)WxPython安装 PYTHON-PIP-WX

(PYTHON_GUI)WxPython安装 PYTHON-PIP-WX

2、升级PIP:python -m pip install --upgrade pip,安装:pip install wxPython-4.0.0b2-cp34-cp34m-win_amd64.whl

(PYTHON_GUI)WxPython安装 PYTHON-PIP-WX(PYTHON_GUI)WxPython安装 PYTHON-PIP-WX(PYTHON_GUI)WxPython安装 PYTHON-PIP-WX

3、安装成功后用pycharm在site-package可看到WX

(PYTHON_GUI)WxPython安装 PYTHON-PIP-WX

五、代码测试

import wx
class ButtonFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, 'Button Example',
                          size=(300, 100))
        panel = wx.Panel(self, -1)
        self.button = wx.Button(panel, -1, "Hello", pos=(50, 20))
        self.Bind(wx.EVT_BUTTON, self.OnClick, self.button)
        self.button.SetDefault()

    def OnClick(self, event):
        self.button.SetLabel("Clicked")


if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = ButtonFrame()
    frame.Show()
    app.MainLoop()

(PYTHON_GUI)WxPython安装 PYTHON-PIP-WX