安裝PyCharm
需要使用者自行去官網
https://www.jetbrains.com/pycharm/下載下傳安裝包,手動安裝。安裝完畢後請設定:
1、簡體中文語言包

2、配置python的環境
3、配置PyQt5外部工具
QtDesigner有兩種配置方法,皆可
QtDesigner
D:\ProgramData\Anaconda3\envs\firecat\Lib\site-packages\pyqt5_tools\Qt\bin\designer.exe
$FileName$
$FileDir$
QtDesigner
D:\ProgramData\Anaconda3\envs\firecat\Scripts\Python38\Scripts\pyqt5designer.exe
$FileDir$
PyUIC有兩種配置方法,皆可。uic負責把qt的ui檔案轉換為py檔案。
PyUIC
D:\ProgramData\Anaconda3\python.exe
-m PyQt5.uic.pyuic $FileName$ -o $FileNameWithoutExtension$_ui.py
$FileDir$
PyUIC
D:\ProgramData\Anaconda3\envs\firecat\Scripts\Python38\Scripts\pyrcc5.exe
$FileName$ -o $FileNameWithoutExtension$_ui.py
$FileDir$
PyRCC的配置方法。rcc負責把qt的qrc檔案轉換為py檔案。
PyRCC
D:\ProgramData\Anaconda3\envs\firecat\Scripts\Python38\Scripts\pyrcc5.exe
$FileName$ -o $FileNameWithoutExtension$_qrc.py
$FileDir$
4、問題解決
輕按兩下執行D:\ProgramData\Anaconda3\envs\firecat\Lib\site-packages\pyqt5_tools\Qt\bin\designer.exe。會彈框報錯:
解決辦法:
把檔案夾D:\ProgramData\Anaconda3\envs\firecat\Lib\site-packages\pyqt5_tools\Qt\plugins拷貝到
D:\ProgramData\Anaconda3\envs\firecat\Lib\site-packages\pyqt5_tools\Qt\bin,覆寫裡面的plugins
安裝Eric(不推薦,功能比PyCharm少很多)
https://sourceforge.net/projects/eric-ide/files/eric6/stable/下載下傳并解壓eric6-20.7.zip,拷貝到D:\ProgramData\Anaconda3\Lib\site-packages\eric6-20.7
打開【開始】菜單的 Anaconda Prompt
cd /d D:\ProgramData\Anaconda3\Lib\site-packages\eric6-20.7\
python install.py install --user
之後會生成檔案夾D:\ProgramData\Anaconda3\Lib\site-packages\eric6
執行程式是D:\ProgramData\Anaconda3\Scripts\eric6.cmd
如果想安裝自動補全CompletionJedi插件,請下載下傳:
https://eric-ide.python-projects.org/plugins6/stable/PluginCompletionJedi.zip然後解壓到路徑:
D:\ProgramData\Anaconda3\Lib\site-packages\eric6\Plugins
安裝繪圖計算軟體之“MSN三劍客”
激活使用者
conda activate firecat
https://pypi.org/project/pip/pip install matplotlib --user
pip install scipy --user
pip install numpy --user
pip install Pillow --user
pip install configobj --user
安裝veusz
Veusz 是一個用來繪制各種科學圖表的 Python 程式庫,可導出為 Postscript 和 PDF 文檔。包含一個易用的圖形化界面,同時也有一些指令行接口以便直接在 Python 程式中調用。
https://github.com/veusz/veusz https://pypi.org/project/veusz/安裝其他軟體,使用離線包的方法
https://www.lfd.uci.edu/~gohlke/pythonlibs/ https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv https://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-imageYou can download all the required wheels files into a folder (e.g D:\my_folder)
and install them from Command Prompt like this:
cd /d D:\my_folder
and for each wheel file (*.whl) run:
D:\my_folder\> pip install --upgrade package_from_requirements.whl
舉例:
(base) C:\Users\firecat>conda activate firecat
(firecat) C:\Users\firecat>pip install Rtree-0.9.4-cp38-cp38-win_amd64.whl
(firecat) C:\Users\firecat>pip install GDAL-3.1.2-cp38-cp38-win_amd64.whl
(firecat) C:\Users\firecat>pip install opencv_python-4.4.0-cp38-cp38-win_amd64.whl
這個檔案中的cp38是指安裝包支援的是Python3.8版本。
Python本地的版本與下載下傳的安裝包的版本要一一比對。否則會報錯:
*.whl is not a supported wheel on this platform
PyQt5測試源碼
# 這是一個示例 Python 腳本。
# 按 Shift+F10 執行或将其替換為您的代碼。
# 按 輕按兩下 Shift 在所有地方搜尋類、檔案、工具視窗、操作和設定。
import sys
from PyQt5 import QtWidgets
def print_hi(name):
# 在下面的代碼行中使用斷點來調試腳本。
print(f'Hi, {name}') # 按 Ctrl+F8 切換斷點。
# 按間距中的綠色按鈕以運作腳本。
if __name__ == '__main__':
print_hi('PyCharm')
app = QtWidgets.QApplication(sys.argv)
widget = QtWidgets.QWidget()
widget.resize(100, 100)
widget.show()
sys.exit(app.exec())
# 通路 https://www.jetbrains.com/help/pycharm/ 擷取 PyCharm 幫助
---
參考文獻
https://blog.csdn.net/kou_ching/article/details/85573634 https://www.anaconda.com/ https://anaconda.org/ https://www.riverbankcomputing.com/