1. 程式人生 > >wxpython在python 3.X下的安裝方法

wxpython在python 3.X下的安裝方法

wxpython在python 3.X下變成了wxpython ProjectPhoenix專案,其官方主頁在[wxpython ProjectPhoenix](https://wiki.wxpython.org/ProjectPhoenix"wxpython ProjectPhoenix官方主頁")網址為https://wiki.wxpython.org/ProjectPhoenix 。換句話說,若想在python 3.X版本下使用wxpython,就必須安裝wxpython ProjectPhoenix。

小編在已經有python2的wxpython情況下,發現使用pip安裝需要在python3.X為主的Windows cmd命令列下才能安裝。小編同時安裝了anaconda 2和 anaconda 3。在這種情況下,需要進入anaconda3的目錄下執行Windows CMD命令列。否則,使用pip進行安裝會報錯。

cmd 命令列

然後才能執行pip命令進行安裝。

以下是運用pip命令進行安裝wxpython ProjectPhoenix的方法。

- 找到合適的安裝版本
安裝檔案下載地址:https://wxpython.org/Phoenix/snapshot-builds/

![wxpython Phoenix安裝版本](https://img-blog.csdn.net/20160715183704479)

其中,檔案命名規則請參考以下引用文字:

File naming conventions:

  • Files with the “*.whl” extension are binary wheel files (

    https://wheel.readthedocs.org/en/latest/). See below for more info.

  • Files with the “*.tar.gz” extension are compressed tar archives of the Phoenix and wxWidgets source code.

  • The “-docs-.tar.gz” files are compressed archives of the documentation.

For example:
wxPython_Phoenix-3.0.3.dev1549+fa6f31f-cp33-cp33m-macosx_10_6_intel.whl

means:
- This is the wxPython_Phoenix package
- It is version 3.0.3.dev1549+fa6f31f (a development version, with
the build number derived from the source control system.)
- It is built for CPython version 3.3
- It is built for the macosx operating system
- It is built for OSX version 10.6 or greater
- It is built for Intel processors.

- 安裝命令
根據wxPython Phoenix Snapshot Builds檔案1
在Windows CMD命令符下,輸入以下命令。
pip install https://wxpython.org/Phoenix/snapshot-builds/(此處新增以上版本截圖檔名)
比如,需要安裝python3.5的wxpython版本:

cmd截圖2

執行以上命令,就可以安裝python 3.X版本的wxpython了。
注:使用wxpython Phoenix API的手冊都在文中wxpython Phoenix下載地址中的tar.gz壓縮包中。