Python 与 Pyqt 开发环境搭建

最新版 Anaconda + Pyqt5 + Eric6 + Pycharm 安装指南

安装包下载

Anaconda 官网下载链接

Pyqt5 exe版不是最新的,最新的 wheel 版下载奇慢,这里直接使用 pip 命令安装。

Eric6 直接官网下载链接

Pycharm 官网下载链接

这里下载的社区版,是免费的,相比专业版缺少部分功能(例如:Web 开发,Python Web 框架,Python 的探查,远程开发能力,数据库和SQL支持),暂时用不到,社区版功能够用了!

开始安装

安装 Anaconda

下载完之后先安装 Anaconda 一路默认安装,加入系统环境变量要勾选上,安装完成后,将源修改为清华的源。可参考Anaconda 镜像使用帮助

Windows 用户无法直接创建名为 .condarc 的文件,可先执行 conda config --set show_channel_urls yes 生成该文件之后再修改,.condarc 文件路径在当前用户目录下。

我的 .condarc 文件如下:

ssl_verify: true
channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

安装 Pyqt5

从 Pyqt5.7 开始,Pyqt 不再提供 exe 的版本,但是直执行 pip install pyqt5 ,会默认拉取最新版本,出现与 sypder 版本不匹配导致 sypder 打不开的问题。所以推荐用下面的方法:

管理员权限打开 Anaconda prompt,执行

pip uninstall spyder

pip install spyder

pip install pyqt5

pip install pyqt5-tools

或者指定用豆瓣的源会更快

pip install pyqt5 -i https://pypi.douban.com/simple

pip install pyqt5-tools -i https://pypi.douban.com/simple

这个装完后添加 pyqt5-tools 目录到环境变量 Path 中或把 pyqt5-tools 安装路径(例如G:\Anaconda3\Lib\site-packages\pyqt5-tools)下的 designer.exe 拷贝到 G:\Anaconda3\Lib\site-packages\PyQt5\Qt\bin。

然后安装 QScintilla 。

pip install QScintilla

pip install QScintilla -i https://pypi.douban.com/simple

安装 Eric6

将下载的压缩包解压到 site-packages 目录下,执行

pip install.py install

我安装时报错 Qsci 有问题,于是卸载 QScintilla,重新安装

重新安装 QScintilla 后,Eric6 也成功安装!

最新版的安装之后桌面会有快捷方式了,不用像旧版一样自己新建。

打开之后是这样子的

安装 Pycharm

社区版是免费的,直接默认安装即可。

大功告成!

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容