Python IDE Eric5 windows安装

前两天在学习wxWidgets这个类似MFC的跨平台C++ GUI framework,发现它在其它语言的绑定也很丰富,于是想尝试一下它的wxPython,好吧,既然是Python绑定,那就需要先安装Python解释器,后来又想装个Python IDE来玩玩,于是开始从网上了解常用的Python IDE及其差异,当然对于我们这种屌丝程序猿商业版的首先不考虑,最后就看中了Eric。

安装Eric开始也碰到一堆问题,总是安装不成功,开始是忘了安装SIP,后来有发现安装后启动失败,查找网上的帖子,也有不少朋友遇到过类似的问题--Python, PyQt, Eric版本兼容的问题。

废话少说,直接上我这边安装成功的各个版本及安装步骤,供大家及自己以后参考或备份。

Eric4的安装类似,只是版本选择差异,请看我的下一篇Python IDE Eric4 windows安装

1. 安装Python,选择版本python-3.2.3

安装完后把Python的安装路径如J:\install\Python32添加到系统的环境变量PATH中。

2. 安装SIP,选择版本sip-4.14.6

确认你的系统是否有安装编译器,我用的是MinGW,编译安装方法如下:
1) 解压sip-4.14.6.zip;
2) 打开CMD,进入sip-4.14.6目录;
3) 运行python configure.py -p win32-g++生成适合特定编译器的Makefile,-p选项就是用来指定编译平台的;
4) 运行mingw32-make编译;
5) 运行mingw32-make install进行安装。
J:\sw\PyQt\sip-4.14.6>python configure.py -p win32-g++
This is SIP 4.14.6 for Python 3.3.1 on win32.
The SIP code generator will be installed in J:\install\Python33.
The sip module will be installed in J:\install\Python33\Lib\site-packages.
The sip.h header file will be installed in J:\install\Python33\include.
The default directory to install .sip files in is J:\install\Python33\sip.
The platform/compiler configuration is win32-g++.
Creating siplib\sip.h...
Creating siplib\siplib.c...
Creating siplib\siplib.sbf...
Creating sipconfig.py...
Creating top level Makefile...
Creating sip code generator Makefile...
Creating sip module Makefile...

3. 安装PyQt,选择版本PyQt-Py3.2-x86-gpl-4.9.4-1.exe

一般它会自动检测Python的安装路径,如果Python的安装路径不对就手动修改,如J:\install\Python32。PyQt会安装到J:\install\Python32\Lib\site-packages\PyQt4目录下。

4. 安装Eric5,选择版本eric5-5.2.2

eric5-i18n-zh_CN.GB2312-5.2.2.zip是中文汉化包,在安装eric5之前把它解压到eric5-5.2.2目录即可。
J:\sw\Eric\eric5-5.2.2>python install.py -a J:\install\Python32\Lib\site-package
s\PyQt4\qsci\api
Checking dependencies
Python Version: 3.2.3
Found PyQt4
Found QtHelp
Found QScintilla2
Qt Version: 4.8.2
PyQt Version:  4.9.4
QScintilla Version:  2.6.2
All dependencies ok.

Compiling user interface files...

Compiling source files...

Installing eric5 ...

Installation complete.

Press enter to continue...

J:\sw\Eric\eric5-5.2.2>
注意安装eric的时候选择API files安装的路径,可以用下面方法查看是否有设置默认的path:
J:\sw\Eric\eric5-5.2.2>python install.py -h

Usage:
    install.py [-chxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]
where:
    -h        display this help message
    -a dir    where the API files will be installed
              (default: C:\Qt\4.8.2\qsci\api)
    -b dir    where the binaries will be installed
              (default: J:\install\Python32)
    -d dir    where eric5 python files will be installed
              (default: J:\install\Python32\Lib\site-packages)
    -f file   configuration file naming the various installation paths
    -x        don't perform dependency checks (use on your own risk)
    -c        don't cleanup old installation first
    -z        don't compile the installed python files

The file given to the -f option must be valid Python code defining a
dictionary called 'cfg' with the keys 'ericDir', 'ericPixDir', 'ericIconDir',
'ericDTDDir', 'ericCSSDir', 'ericStylesDir', 'ericDocDir', 'ericExamplesDir',
'ericTranslationsDir', 'ericTemplatesDir', 'ericCodeTemplatesDir',
'ericOthersDir','bindir', 'mdir' and 'apidir.
These define the directories for the installation of the various parts of eric5.

Press enter to continue...
我这里默认是C:\Qt\4.8.2\qsci\api,但是我不想让它安装在这里,所以我用-a J:\install\Python32\Lib\site-packages\PyQt4\qsci\api把它指定到这个路径下统一管理。
eric一般也会自动检测Python的安装路径上面的-b, -d选项可以查看,如果路径不正确请在安装命令里面指定,安装完后可以到J:\install\Python32目录下运行eric5.bat或J:\install\Python32\Lib\site-packages\eric5\eric5.pyw.

5. 配置Eric5

1) Editor -> Autocompletion -> QScintilla,勾选"Show single"和“Use fill-up characters”,并且把"Source"选为“from Document and API files”;
2) Editor -> APIs,选择"Language:"为"Python3",添加API的路径,J:\install\Python32\Lib\site-packages\PyQt4\qsci\api\python\eric5.api,这个路径跟上面安装eric时用-a指定的路径一致;
3) Interface -> Interface,选择"Language:"为"中文(zh_CN.GB2312)",这个就是上面安装eric之前要解压的中文汉化包。

6. Eric5 Project Demo

1) Project -> New,在打开的Project Properties属性对话框中填入:
Project Name: helloworld,这个项目名称也可以自己定义
Progr. Lanuage: Python3
Project Type: Qt4 GUI
Project Directory: J:\sw\PyQt\my_workspace\helloworld\,这个路径可以根据需要自己选定
其它选项可选填。
确定后在弹出的对话框"Select version control system for the project"选择None即可,因为还没有安装或配置版本控制系统。
2) 在Eric界面的右侧Project-Viewer中选择Forms,鼠标右键->New form,弹出的对话框“Select a form type”选择Widget类型,根据不同的应用可选择不同的类型,如Dialog, Main Window等。保存为helloworld.ui,此时会自动弹出Qt Designer界面供程序猿设计UI,如简单地添加一个Label控件并把它的Text属性改为“Hello World!”即可。
3) 用Qt Designer设计完helloworld.ui后回到Eric界面的Project-Viewer->Forms,选中helloworld.ui鼠标右键后选择Compile form可以生成Ui_helloworld.py这个Python脚本。
可以通过Project-Viewer->Sources找到Ui_helloworld.py,鼠标左键双击打开,然后按F2或者菜单Start->Run Script来运行这个脚本。

本想贴点截图来说明的,这样直观点,奈何在公司写的这篇,因公司管制,截图上传不了,所以大部分只能以文字描述,真憋气。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值