【问题标题】:Installing wx python in python3在 python3 中安装 wx python
【发布时间】:2016-10-06 09:50:15
【问题描述】:

我正在 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 而不会出现此错误?

【问题讨论】:

    标签: python-3.x wxpython wxwidgets


    【解决方案1】:

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

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

    【讨论】:

    • 快照站点现在有 SSL 证书和 https://... 支持,因此如果您切换 URL,则可以删除 --trusted-host 标志。
    • 此外,由于它看起来像是在使用 Linux 系统,因此那里没有可用的预构建二进制文件,因此 pip 需要为您的系统自行构建。这样做需要许多必备库和头文件,请参阅github.com/wxWidgets/Phoenix#prerequisites 的列表,并密切关注构建的configure 步骤的输出,以查看您的系统上是否需要其他任何东西.
    猜你喜欢
    • 2020-07-11
    • 2015-08-04
    • 1970-01-01
    • 2018-03-26
    • 1970-01-01
    • 2019-03-31
    • 2012-04-03
    • 2017-02-16
    • 1970-01-01
    相关资源
    最近更新 更多