Ubuntu 18.04 wxPython安装报错:ERROR: failed building wxWidgets

pip安装wxPython:

pip install -U wxPython==4.0.7

报错:

 Error running configure
  ERROR: failed building wxWidgets
  Traceback (most recent call last):
    File "build.py", line 1468, in cmd_build_wx
      wxbuild.main(wxDir(), build_options)
    File "/tmp/pip-install-8_i22mue/wxpython_1dca4dfcf7a746f6a2814ed2001d3b45/buildtools/build_wxwidgets.py", line 373, in main
      "Error running configure")
    File "/tmp/pip-install-8_i22mue/wxpython_1dca4dfcf7a746f6a2814ed2001d3b45/buildtools/build_wxwidgets.py", line 85, in exitIfError
      raise builder.BuildError(msg)
  buildtools.builder.BuildError: Error running configure
  Finished command: build_wx (0m3.443s)
  Finished command: build (0m3.443s)
  Command '"/home/zijiesun/anaconda3/envs/DLC2/bin/python" -u build.py build' failed with exit code 1.
  ----------------------------------------
  ERROR: Failed building wheel for wxPython

解决方法:
在wxPython包库找到自己需要的版本,进入该文件夹,笔者系统为ubuntu18.04,所以进入该目录,选择对于版本的wxPython whl文件下载,例如,笔者系统为linux,python3.7,所以选择:
在这里插入图片描述
下载后,cd进入whl包所在路径:

pip install wxPython-4.0.7-cp37-cp37m-linux_x86_64.whl

安装成功:

Processing ./wxPython-4.0.7-cp37-cp37m-linux_x86_64.whl
Requirement already satisfied: six in /home/zijiesun/anaconda3/envs/DLC2/lib/python3.7/site-packages (from wxPython==4.0.7) (1.15.0)
Requirement already satisfied: numpy in /home/zijiesun/anaconda3/envs/DLC2/lib/python3.7/site-packages (from wxPython==4.0.7) (1.16.4)
Requirement already satisfied: pillow in /home/zijiesun/anaconda3/envs/DLC2/lib/python3.7/site-packages (from wxPython==4.0.7) (8.0.1)
Installing collected packages: wxPython
Successfully installed wxPython-4.0.7

参考:

- [1] (blog) https://blog.csdn.net/weixin_38608322/article/details/105542530

你可能感兴趣的:(Python)