TOP

2020年9月24日 星期四

[QT] Install PyQt5 on Win7x64

PyQt 5.x

https://www.riverbankcomputing.com

Doc: https://www.riverbankcomputing.com/static/Docs/PyQt5/

Eric 6.x

http://eric-ide.python-projects.org

  


[Install PyQt on Windows]

透過 pip 安裝 PyQt

[1] Python & pip

PS C:\Windows\system32> python --version

Python 3.8.5

PS C:\Windows\system32> pip --version

pip 20.2 from c:\users\qoo\appdata\local\programs\python\python38\lib\site-packages\pip (python 3.8)

 

[2] PyQt5: pip install PyQt5 -i https://pypi.douban.com/simple

PS C:\Windows\system32> pip install PyQt5 -i https://pypi.douban.com/simple

Looking in indexes: https://pypi.douban.com/simple

Collecting PyQt5

  Downloading https://pypi.doubanio.com/packages/7c/06/0b3cbfd63fc6cbd3585d1a3b2729055e19c646ae329050e174e3c29a4741/PyQt

5-5.15.0-5.15.0-cp35.cp36.cp37.cp38-none-win_amd64.whl (64.5 MB)

     |████████████████████████████████| 64.5 MB 1.6 MB/s

Collecting PyQt5-sip<13,>=12.8

  Downloading https://pypi.doubanio.com/packages/3f/40/6722c66e43cbdb69df7ebab4d8e3ad5ae923226b3a3f7c93d47aebc1f052/PyQt

5_sip-12.8.0-cp38-cp38-win_amd64.whl (63 kB)

     |████████████████████████████████| 63 kB 855 kB/s

Installing collected packages: PyQt5-sip, PyQt5

Successfully installed PyQt5-5.15.0 PyQt5-sip-12.8.0

 

[3] PyQt5-tools: pip install PyQt5-tools -i https://pypi.douban.com/simple

PS C:\Windows\system32> pip install PyQt5-tools -i https://pypi.douban.com/simple

Looking in indexes: https://pypi.douban.com/simple

Collecting PyQt5-tools

  Downloading https://pypi.doubanio.com/packages/09/9a/818a748b12464fa966d43218dfbdca1e02f43859196994eae8b5b064261a/pyqt

5_tools-5.15.0.1.7.1-cp38-cp38-win_amd64.whl (57.4 MB)

     |████████████████████████████████| 57.4 MB 3.3 MB/s

Collecting python-dotenv

  Downloading https://pypi.doubanio.com/packages/f2/16/28d434b28c5be29a6af8fd0e3a2bda3bd30500ef0cd17bc79f7a6793a8d4/pyth

on_dotenv-0.14.0-py2.py3-none-any.whl (17 kB)

Collecting click

  Downloading https://pypi.doubanio.com/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/clic

k-7.1.2-py2.py3-none-any.whl (82 kB)

     |████████████████████████████████| 82 kB 446 kB/s

Requirement already satisfied: pyqt5==5.15.0 in c:\users\qoo\appdata\local\programs\python\python38\lib\site-packages (from PyQt5-tools) (5.15.0)

Requirement already satisfied: PyQt5-sip<13,>=12.8 in c:\users\qoo\appdata\local\programs\python\python38\lib\site-packages (from pyqt5==5.15.0->PyQt5-tools) (12.8.0)

Installing collected packages: python-dotenv, click, PyQt5-tools

Successfully installed PyQt5-tools-5.15.0.1.7.1 click-7.1.2 python-dotenv-0.14.0

 

[4] 安裝位置:

C:\Users\qoo\AppData\Local\Programs\Python\Python38\Lib\site-packages

 

[5] 測試 PyQt5 module

python console 中執行:

import PyQt5

help (PyQt5)

 

 

[Install Python modules]

Qscintilla: pip install Qscintilla -i https://pypi.douban.com/simple (for Eric 6)

PS C:\Users\qoo> pip install Qscintilla -i https://pypi.douban.com/simple

Looking in indexes: https://pypi.douban.com/simple

Collecting Qscintilla

  Downloading https://pypi.doubanio.com/packages/11/20/6367655531bb2a1d4a39d8a6cbd91ec821553cd4367f2ff38002eb29b58e/QSci

ntilla-2.11.5-cp35.cp36.cp37.cp38-none-win_amd64.whl (1.8 MB)

     |████████████████████████████████| 1.8 MB 1.3 MB/s

Requirement already satisfied: PyQt5-sip<13,>=12.8 in c:\users\qoo\appdata\local\programs\python\python38\lib\site-packa

ges (from Qscintilla) (12.8.0)

Requirement already satisfied: PyQt5>=5.10.1 in c:\users\qoo\appdata\local\programs\python\python38\lib\site-packages (from Qscintilla) (5.15.0)

Installing collected packages: Qscintilla

Successfully installed Qscintilla-2.11.5

 

PyInstaller: pip install PyInstaller (Py -> Windows EXE, 有病毒警告, 移除掉)

PS C:\Program Files (x86)\eric6> pip install PyInstaller

Collecting PyInstaller

  Downloading pyinstaller-4.0.tar.gz (3.5 MB)

     |████████████████████████████████| 3.5 MB 2.2 MB/s

  Installing build dependencies ... done

  Getting requirements to build wheel ... done

    Preparing wheel metadata ... done

Collecting pyinstaller-hooks-contrib>=2020.6

  Downloading pyinstaller_hooks_contrib-2020.7-py2.py3-none-any.whl (152 kB)

     |████████████████████████████████| 152 kB 2.2 MB/s

Requirement already satisfied: setuptools in c:\users\qoo\appdata\local\programs\python\python38\lib\site-packages (from

PyInstaller) (47.1.0)

Collecting pefile>=2017.8.1; sys_platform == "win32"

  Downloading pefile-2019.4.18.tar.gz (62 kB)

     |████████████████████████████████| 62 kB 193 kB/s

Collecting altgraph

  Downloading altgraph-0.17-py2.py3-none-any.whl (21 kB)

Collecting pywin32-ctypes>=0.2.0; sys_platform == "win32"

  Downloading pywin32_ctypes-0.2.0-py2.py3-none-any.whl (28 kB)

Collecting future

  Downloading future-0.18.2.tar.gz (829 kB)

     |████████████████████████████████| 829 kB 2.2 MB/s

Building wheels for collected packages: PyInstaller, pefile, future

  Building wheel for PyInstaller (PEP 517) ... done

  Created wheel for PyInstaller: filename=pyinstaller-4.0-py3-none-any.whl size=2635927 sha256=b78d0447648df2541d6b23c41

939c102014d9b986936259bf63a117a5c0bf7f3

  Stored in directory: c:\users\qoo\appdata\local\pip\cache\wheels\9b\28\8f\f51ae22c4391bbeb36c8fdc68203b0c094445b4db824

a6ab7d

  Building wheel for pefile (setup.py) ... done

  Created wheel for pefile: filename=pefile-2019.4.18-py3-none-any.whl size=60827 sha256=78d4ebde70499cfd8dfa8dd9a48f78b

71d2c38ff213f20a508fefd68d573c268

  Stored in directory: c:\users\qoo\appdata\local\pip\cache\wheels\42\52\d5\9550bbfb9eeceaf0f19db1cf651cc8ba41d3bcf8b4d2

0e4279

 Building wheel for future (setup.py) ... done

  Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491062 sha256=25c5283b2621264a8c2e8c4653fd7384f

b61f47d546814814a6e927ee2a0e05b

  Stored in directory: c:\users\qoo\appdata\local\pip\cache\wheels\8e\70\28\3d6ccd6e315f65f245da085482a2e1c7d14b90b30f23

9e2cf4

Successfully built PyInstaller pefile future

Installing collected packages: pyinstaller-hooks-contrib, future, pefile, altgraph, pywin32-ctypes, PyInstaller

Successfully installed PyInstaller-4.0 altgraph-0.17 future-0.18.2 pefile-2019.4.18 pyinstaller-hooks-contrib-2020.7 pywin32-ctypes-0.2.0

若仍需要 PyInstaller  功能,可改用:py2exe

 

[API document]

[1] query inline

from PyQt5.QtWidgets import QWidget

dir (QWidget)

help (QWdiget)

[2] print to txt

import sys

from PyQt5.QtWidgets import QWidget

 

out = sys.stdout

sys.stdout = open(r'E:\QWidget.txt' , 'w')

help( QWidget  )

sys.stdout.close()

sys.stdout = out

[3] online document

http://pyqt.sourceforge.net/Docs/PyQt5/class_reference.html

 

[Eric 6]

http://eric-ide.python-projects.org

 

[1] download Eric6

https://sourceforge.net/projects/eric-ide/files/latest/download

=> eric6-20.8.zip

 

[2] 解壓縮後移至 C:\Program Files (x86)\ 並改名為 eric6

=> C:\Program Files (x86)\eric6

 

[3] 安裝:python install.py

PS C:\Users\qoo> cd "C:\Program Files (x86)\eric6"

PS C:\Program Files (x86)\eric6> python .\install.py

Checking dependencies

'pip' is outdated (installed 20.2, available 20.2.2)

Shall 'pip' be updated (recommended)? (Y/n)

Collecting pip

  Downloading pip-20.2.2-py2.py3-none-any.whl (1.5 MB)

     |████████████████████████████████| 1.5 MB 595 kB/s

Installing collected packages: pip

  Attempting uninstall: pip

    Found existing installation: pip 20.2

    Uninstalling pip-20.2:

      Successfully uninstalled pip-20.2

Successfully installed pip-20.2.2

 

 

Python Version: 3.8.5

Found PyQt5

Found pyuic5

PyQtWebEngine could not be detected.

Error: cannot import name 'QtWebEngineWidgets' from 'PyQt5' (C:\Users\qoo\AppData\Local\Programs\Python\Python38\lib\sit

e-packages\PyQt5\__init__.py)

 

Shall 'PyQtWebEngine' be installed using pip? (Y/n)

Collecting PyQtWebEngine

  Downloading PyQtWebEngine-5.15.0-5.15.0-cp35.cp36.cp37.cp38-none-win_amd64.whl (57.9 MB)

     |████████████████████████████████| 57.9 MB 1.1 MB/s

Requirement already satisfied: PyQt5-sip<13,>=12.8 in c:\users\qoo\appdata\local\programs\python\python38\lib\site-packa

ges (from PyQtWebEngine) (12.8.0)

Requirement already satisfied: PyQt5>=5.15 in c:\users\qoo\appdata\local\programs\python\python38\lib\site-packages (from PyQtWebEngine) (5.15.0)

Installing collected packages: PyQtWebEngine

Successfully installed PyQtWebEngine-5.15.0

 

PyQtChart could not be detected.

Error: cannot import name 'QtChart' from 'PyQt5' (C:\Users\qoo\AppData\Local\Programs\Python\Python38\lib\site-packages\

PyQt5\__init__.py)

 

Shall 'PyQtChart' be installed using pip? (Y/n)

Collecting PyQtChart

  Downloading PyQtChart-5.15.0-5.15.0-cp35.cp36.cp37.cp38-none-win_amd64.whl (927 kB)

     |████████████████████████████████| 927 kB 547 kB/s

Requirement already satisfied: PyQt5>=5.15 in c:\users\qoo\appdata\local\programs\python\python38\lib\site-packages (from PyQtChart) (5.15.0)

Requirement already satisfied: PyQt5-sip<13,>=12.8 in c:\users\qoo\appdata\local\programs\python\python38\lib\site-packages (from PyQtChart) (12.8.0)

Installing collected packages: PyQtChart

Successfully installed PyQtChart-5.15.0

 

Found QScintilla2

Found QtGui

Found QtNetwork

Found QtPrintSupport

Found QtSql

Found QtSvg

Found QtWidgets

Found QtWebEngineWidgets

Qt Version: 5.15.0

sip Version: 5.3.0

PyQt Version: 5.15.0

QScintilla Version: 2.11.5

PyQtWebEngine. 5.15.0

All dependencies ok.

 

Cleaning up old installation ...

 

Creating configuration file ...

 

Compiling user interface files ...

 

Compiling source files ...

 

Installing eric6 ...

Installing Python API files to 'C:\Users\qoo\AppData\Local\Programs\Python\Python38\Lib\site-packages\PyQt5\Qt\qsci\api\python'.

Installing Ruby API files to 'C:\Users\qoo\AppData\Local\Programs\Python\Python38\Lib\site-packages\PyQt5\Qt\qsci\api\ruby'.

Installing QSS API files to 'C:\Users\qoo\AppData\Local\Programs\Python\Python38\Lib\site-packages\PyQt5\Qt\qsci\api\qss'.

 

The Python package 'pywin32' could not be imported.

 

Shall 'pywin32' be installed using pip? (Y/n)

Collecting pywin32

  Downloading pywin32-228-cp38-cp38-win_amd64.whl (9.1 MB)

     |████████████████████████████████| 9.1 MB 1.7 MB/s

Installing collected packages: pywin32

Successfully installed pywin32-228

 

Installation complete.

 

 

Press enter to continue...

 

[4] 執行:python "C:\Program Files (x86)\eric6\eric\eric6\eric6.pyw"

或將此檔捷徑拖出, 可直接 double click 執行

(安裝後會在桌面產生2個捷徑, 所以可以不用自己建立)

 

[5] 設定客製化

font

auto completion

API reference

jedi 自動補全插件

 

[6] 文件

 



沒有留言:

張貼留言