本文介绍了在Windows下开发界面,所用的开发环境的搭建过程,主要的内容为cmd命令窗口下的语句内容。
前提:已经安装python(本次实验的版本为python3.6.8)、解压Eric6(本次实验把压缩包直接放在目录D盘下)同时最好能更换pip国内镜像源。
CMD窗口的命令:
C:\Users\Wss>python -m pip install --upgrade pip
C:\Users\Wss>pip list
C:\Users\Wss>pip install PyQt5==5.10.1
C:\Users\Wss>pip install PyQt5-tools==5.10.1.1.3
C:\Users\Wss>pip install QScintilla==2.10.4
C:\Users\Wss>pip install pywin32
C:\Users\Wss>cd D:\eric6-20.2\eric6-20.2
C:\Users\Wss>d:
D:\eric6-20.2\eric6-20.2>python install.py
CMD窗口的内容:
C:\Users\Wss>python -m pip install --upgrade pip
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pip
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 3.5MB/s
Installing collected packages: pip
Found existing installation: pip 18.1
Uninstalling pip-18.1:
Successfully uninstalled pip-18.1
Successfully installed pip-20.0.2
C:\Users\Wss>pip list
Package Version
--------------- ----------
Click 7.0
cycler 0.10.0
kiwisolver 1.1.0
numpy 1.18.1
pip 20.0.2
pyparsing 2.4.6
python-dateutil 2.8.1
python-dotenv 0.11.0
setuptools 40.6.2
six 1.14.0
C:\Users\Wss>pip install PyQt5==5.10.1
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting PyQt5==5.10.1
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Read timed out. (read timeout=15)",)': /packages/a7/22/67cc2bac6ae2cd3a7eabb2a2e91638b94bdc6e0503747e49670ce44bb5b0/PyQt5-5.10.1-5.10.1-cp35.cp36.cp37.cp38-none-win_amd64.whl
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a7/22/67cc2bac6ae2cd3a7eabb2a2e91638b94bdc6e0503747e49670ce44bb5b0/PyQt5-5.10.1-5.10.1-cp35.cp36.cp37.cp38-none-win_amd64.whl (81.0 MB)
|████████████████████████████████| 81.0 MB 2.2 MB/s
Collecting sip<4.20,>=4.19.4
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/30/fa/90ea79d7b6b21a50e16d2e1214bd4d45390ee1b5393dc09c3785a3dc9c7e/sip-4.19.8-cp36-none-win_amd64.whl (51 kB)
|████████████████████████████████| 51 kB 3.2 MB/s
Installing collected packages: sip, PyQt5
Attempting uninstall: sip
Found existing installation: sip 5.1.1
Uninstalling sip-5.1.1:
Successfully uninstalled sip-5.1.1
Successfully installed PyQt5-5.10.1 sip-4.19.8
C:\Users\Wss>pip install PyQt5-tools==5.10.1.1.3
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting PyQt5-tools==5.10.1.1.3
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/94/5e/be1f8431e400853ffada1400f84f5177673b1084cecfe8f8b6a41dca0387/pyqt5_tools-5.10.1.1.3-cp36-none-win_amd64.whl (38.2 MB)
|████████████████████████████████| 38.2 MB 6.4 MB/s
Requirement already satisfied: python-dotenv in d:\programdata\python\python36\lib\site-packages (from PyQt5-tools==5.10.1.1.3) (0.11.0)
Requirement already satisfied: click in d:\programdata\python\python36\lib\site-packages (from PyQt5-tools==5.10.1.1.3) (7.0)
Installing collected packages: PyQt5-tools
Successfully installed PyQt5-tools-5.10.1.1.3
C:\Users\Wss>pip install QScintilla==2.10.4
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting QScintilla==2.10.4
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/23/fe/7d897ffa937636f6df008a3caf40bbe158fb0a653c72ca04be402e1df7e0/QScintilla-2.10.4-5.10.1-cp35.cp36.cp37.cp38-none-win_amd64.whl (1.9 MB)
|████████████████████████████████| 1.9 MB 819 kB/s
Requirement already satisfied: PyQt5>=5.10.1 in d:\programdata\python\python36\lib\site-packages (from QScintilla==2.10.4) (5.10.1)
Requirement already satisfied: sip<4.20,>=4.19.4 in d:\programdata\python\python36\lib\site-packages (from PyQt5>=5.10.1->QScintilla==2.10.4) (4.19.8)
Installing collected packages: QScintilla
Successfully installed QScintilla-2.10.4
C:\Users\Wss>pip install pywin32
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pywin32
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/f7/76/29e8e24a4967eb40fdf2f525aae53a1fd6e606382d957aa403f3f12ea235/pywin32-227-cp36-cp36m-win_amd64.whl (9.1 MB)
|████████████████████████████████| 9.1 MB 1.6 MB/s
Installing collected packages: pywin32
Successfully installed pywin32-227
C:\Users\Wss>cd D:\eric6-20.2\eric6-20.2
C:\Users\Wss>d:
D:\eric6-20.2\eric6-20.2>python install.py
Checking dependencies
Python Version: 3.6.8
Found PyQt5
Found pyuic5
PyQtChart could not be detected.
Error: cannot import name 'QtChart'
Shall 'PyQtChart' be installed using pip? (Y/n) n
Found QScintilla2
Found QtGui
Found QtNetwork
Found QtPrintSupport
Found QtSql
Found QtSvg
Found QtWidgets
Found QtWebEngineWidgets
Qt Version: 5.10.1
sip Version: 4.19.8
PyQt Version: 5.10.1
QScintilla Version: 2.10.4
All dependencies ok.
Cleaning up old installation ...
Creating configuration file ...
Compiling user interface files ...
Compiling source files ...
Installing eric6 ...
Installing Python API files to 'D:\ProgramData\Python\Python36\Lib\site-packages\PyQt5\Qt\qsci\api\python'.
Installing Ruby API files to 'D:\ProgramData\Python\Python36\Lib\site-packages\PyQt5\Qt\qsci\api\ruby'.
Installing QSS API files to 'D:\ProgramData\Python\Python36\Lib\site-packages\PyQt5\Qt\qsci\api\qss'.
Installation complete.
Press enter to continue...
解释:
在安装QScintilla时,之所以选择2.10.4版本,是因为需要对应PyQt5的版本(正如上文所述,本次实验版本为5.10.1),我们可以从上面内容中发现:“QScintilla-2.10.4-5.10.1-cp35.cp36.cp37.cp38-none-win_amd64.whl”中的“5.10.1”与PyQt5的版本一致,如下代码框所示。
C:\Users\Wss>pip install QScintilla==2.10.4
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting QScintilla==2.10.4
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/23/fe/7d897ffa937636f6df008a3caf40bbe158fb0a653c72ca04be402e1df7e0/QScintilla-2.10.4-5.10.1-cp35.cp36.cp37.cp38-none-win_amd64.whl (1.9 MB)
选择PyQt5的5.10.1版本,主要是因为“PyQt 5.10.0以上版本都会出现PyqtWebEngine couldn’t be detected的问题”。
参考资料:
1. python3.7+PyQt5+Eric6安装详解——梦游吧
2. Eric6+PyQt5(Python3.7)安装教程(完美解决安装过程中PyqtWebEngine couldn't be detected 的问题)——SunStrongInChina