Anaconda3-2020.07+PyQt5.15.0+PyCharm2019.3+Eric6-20.7的安装

安装Anaconda3

1、下载版本是Anaconda3-2020.07-Windows-x86_64.exe
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
默认安装,默认勾选,安装路径不能有空格,例如D:\ProgramData\Anaconda3

安装完,桌面-开始菜单,可以看到:

Anaconda3-2020.07+PyQt5.15.0+PyCharm2019.3+Eric6-20.7的安装_第1张图片

2、新建虚拟环境

打开开始菜单的 Anaconda Prompt

查看已有环境,新安装的Anaconda3中只存在一个base环境

conda info -e 或者 conda env list

创建环境

conda  create -n firecat python=3.8

激活新安装的环境

conda activate firecat

取消激活,并返回默认的base环境

conda deactivate

删除一个已有的环境

conda remove --name firecat --all

注:创建自己的环境firecat之后,会生成文件夹D:\ProgramData\Anaconda3\envs\firecat

3、修改pip的安装路径

查看默认安装路径的终端命令是 python -m site
USER_SITE: 'C:\\Users\\firecat\\AppData\\Roaming\\Python\\Python38\\site-packages' (exists)
USER_BASE: 'C:\\Users\\firecat\\AppData\\Roaming\\Python' (exists)

D:\ProgramData\Anaconda3\Lib\site.py,第87行

# Enable per user site-packages directory
# set it to False to disable the feature or True to force the feature
ENABLE_USER_SITE = None

# for distutils.commands.install
# These values are initialized by the getuserbase() and getusersitepackages()
# functions, through the main() function when Python starts.
USER_SITE = None
USER_BASE = None

修改为自定义,

# Enable per user site-packages directory
# set it to False to disable the feature or True to force the feature
ENABLE_USER_SITE = True

# for distutils.commands.install
# These values are initialized by the getuserbase() and getusersitepackages()
# functions, through the main() function when Python starts.
USER_SITE = "D:\\ProgramData\\Anaconda3\\envs\\firecat\\Lib\\site-packages"
USER_BASE = "D:\\ProgramData\\Anaconda3\\envs\\firecat\\Scripts"

 

安装PyQt5

1、方法1,默认安装PyQt5
打开开始菜单的 Anaconda Prompt

激活自己的环境

conda activate firecat

查看

pip list

conda list

安装
pip install pyqt5 --user
pip install pyqt5-tools --user
pip install PyQt5-stubs --user
pip install PyQtChart --user
pip install pyqtwebengine --user
pip install qscintilla --user

卸载

pip uninstall pyqt5 -y
pip uninstall pyqt5-tools -y
pip uninstall PyQt5-stubs -y
pip uninstall qscintilla -y
pip uninstall pyqtwebengine -y
pip uninstall PyQtChart -y
pip uninstall PyQt5-sip -y

退出自己的环境

conda deactivate

2、方法2,pip换源安装PyQt

打开开始菜单的 Anaconda Prompt
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyqt5 --user
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyqt5-tools --user
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple qscintilla --user

或者直接全局更为镜像源:

windows下,直接在user目录中创建一个pip目录,如:C:\Users\firecat\pip,新建文件pip.ini,内容如下
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

 

安装PyCharm

https://www.jetbrains.com/pycharm/

1、配置python的环境

Anaconda3-2020.07+PyQt5.15.0+PyCharm2019.3+Eric6-20.7的安装_第2张图片

Anaconda3-2020.07+PyQt5.15.0+PyCharm2019.3+Eric6-20.7的安装_第3张图片

 

2、配置PyQt5外部工具

Anaconda3-2020.07+PyQt5.15.0+PyCharm2019.3+Eric6-20.7的安装_第4张图片

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$

 

3、问题解决

双击执行D:\ProgramData\Anaconda3\envs\firecat\Lib\site-packages\pyqt5_tools\Qt\bin\designer.exe。会弹框报错:

Anaconda3-2020.07+PyQt5.15.0+PyCharm2019.3+Eric6-20.7的安装_第5张图片

解决办法:

把文件夹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三剑客

pip install matplotlib --user

pip install Pillow --user

pip install numpy --user

pip install scipy --user

pip install configobj --user

https://pypi.org/project/pip/

https://www.lfd.uci.edu/~gohlke/pythonlibs/

You 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
这个文件中的cp38是指安装包支持的是Python3.8版本。
Python本地的版本与下载的安装包的版本要一一匹配。否则会报错:
*.whl is not a supported wheel on this platform

 

PyQt5测试源码

import sys
from PyQt5 import QtWidgets

app = QtWidgets.QApplication(sys.argv)
widget = QtWidgets.QWidget()
widget.resize(100 , 100)
widget.show()
sys.exit(app.exec())

 

 

---

参考文献

https://blog.csdn.net/kou_ching/article/details/85573634

https://www.anaconda.com/

https://anaconda.org/

https://www.riverbankcomputing.com/

 

你可能感兴趣的:(Python,Anaconda,PyQt5,Eric,PyCharm)