一、安装Python2.7+Ulipad
1、首先安装Python
Python 下载地址:http://www.python.org/getit/
我们这里使用的版本是 Python 2.7.5 Windows X86-64 Installer
双击安装,我们安装到 D:\Python27(自己决定)
2、安装Ulipad
这里我们使用的版本是ulipad.4.2.py26.exe
双击安装,我们安装到 D:\Ulipad(自己决定)
3、安装 wxPython 模块
我们这里选择 wxPython2.8-win64-unicode-py27 它对应的是 Python 2.7版本。
双击安装。
4、安装comtypes模块
目前最新版本 comtypes-0.6.2.win32.exe ,双击安装。
5、UliPad执行
在Ulipad目录下,双击UliPad.exe 可以执行并打开Ulipad编辑器。
6、配置Ulipad
打开Ulipad,选择菜单=>编辑=>参数=>Python=>设置Python解释器=>增加
输入解释器路径 可以手动选择Python安装文件夹下的python.exe文件 描述设置为2.7 console
再新增个Python文件夹下的Pythonw.exe 描述为2.7 window 。最后确定完成。
二、常见错误及解决办法
1.安装comtypes模块报告找不到Python目录
即不能识别出python2.7
解决方法:
#
# script to register Python 2.0 or later for use with win32all
# and other extensions that require Python registry settings
#
# written by Joakim Loew for Secret Labs AB / PythonWare
#
# source:
# http://www.pythonware.com/products/works/articles/regpy20.htm
#
# modified by Valentine Gogichashvili as described in http://www.mail-archive.com/distutils-sig@python.org/msg10512.html
import sys
from _winreg import *
# tweak as necessary
version = sys.version[:3]
installpath = sys.prefix
regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)
installkey = "InstallPath"
pythonkey = "PythonPath"
pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % (
installpath, installpath, installpath
)
def RegisterPy():
try:
reg = OpenKey(HKEY_CURRENT_USER, regpath)
except EnvironmentError as e:
try:
reg = CreateKey(HKEY_CURRENT_USER, regpath)
SetValue(reg, installkey, REG_SZ, installpath)
SetValue(reg, pythonkey, REG_SZ, pythonpath)
CloseKey(reg)
except:
print "*** Unable to register!"
return
print "--- Python", version, "is now registered!"
return
if (QueryValue(reg, installkey) == installpath and
QueryValue(reg, pythonkey) == pythonpath):
CloseKey(reg)
print "=== Python", version, "is already registered!"
return
CloseKey(reg)
print "*** Unable to register!"
print "*** You probably have another Python installation!"
if __name__ == "__main__":
RegisterPy()
保存并复制到根目录下面。
②打开命令行窗口定位到D盘,然后输入 python register.py 然后显示 “Python 2.7 is already registered!”.
③然后再安装comtypes就可以识别出Python2.7.
2.命令行窗口中python不是内部命令
解决办法:
假设python安装在D:\python27。
我的电脑->属性->高级->环境变量->系统变量 中在PATH加上 D:\Python27(注意分号)