在python3中安装wx python

时间:2016-10-06 09:50:16

标签: python-3.x wxpython wxwidgets

我在python 3中运行具有以下导入的视频播放器文件

import os
import time
import wx
import MplayerCtrl as mpc
import wx.lib.buttons as buttons

我第一次得到这个:

Traceback (most recent call last):
  File "videoplayer.py", line 3, in <module>
    import wx
ImportError: No module named 'wx'

当我尝试使用pip3 install wx安装wx时,会发生这种情况:

 Downloading/unpacking wx
      Downloading wx-3.0.3.tar.gz (41.8MB): 17.1MB downloaded
    Cleaning up...
    Exception:
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
        status = self.run(options, args)
      File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 278, in run
        requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
      File "/usr/lib/python3/dist-packages/pip/req.py", line 1198, in prepare_files
        do_download,
      File "/usr/lib/python3/dist-packages/pip/req.py", line 1376, in unpack_url
        self.session,
      File "/usr/lib/python3/dist-packages/pip/download.py", line 572, in unpack_http_url
        download_hash = _download_url(resp, link, temp_location)
      File "/usr/lib/python3/dist-packages/pip/download.py", line 433, in _download_url
        for chunk in resp_read(4096):
      File "/usr/lib/python3/dist-packages/pip/download.py", line 421, in resp_read
        chunk_size, decode_content=False):
      File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/response.py", line 225, in stream
        data = self.read(amt=amt, decode_content=decode_content)
      File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/response.py", line 174, in read
        data = self._fp.read(amt)
      File "/usr/lib/python3.4/http/client.py", line 500, in read
        return super(HTTPResponse, self).read(amt)
      File "/usr/lib/python3.4/http/client.py", line 539, in readinto
        n = self.fp.readinto(b)
      File "/usr/lib/python3.4/socket.py", line 374, in readinto
        return self._sock.recv_into(b)
      File "/usr/lib/python3.4/ssl.py", line 769, in recv_into
        return self.read(nbytes, buffer)
      File "/usr/lib/python3.4/ssl.py", line 641, in read
        v = self._sslobj.read(len, buffer)
    socket.timeout: The read operation timed out

    Storing debug log for failure in /home/cc/.pip/pip.log

如何在python3中安装wx而不会产生此错误?

1 个答案:

答案 0 :(得分:0)

使用以下命令安装python 3 wxpython phoenix。

pip3 install -U --pre --trusted-host wxpython.org -f http://wxpython.org/Phoenix/snapshot-builds/ wxPython_Phoenix