解决安装Ulipad时的一个错误

最近在看<dive in python>,学习的过程中要用到Ulipad这个python ide。所以便去网上下载安装软件安装。安装过程比较顺利,先是安装了python 2.7.1并设置了Path环境变量,然后安装了wyPython2.8,然后再需要安装comtypes 0.6.2就可以了。但是在安装comtypes时却遇到了一个错误,错误信息如下:

With Python 2.7, DistutilsOptionError was removed from distutils.core, though it still officially remains in distutils.errors. This causes comtypes to not install properly. Instead, an error similar to the following is generated:
\comtypes> .\setup.py
Traceback (most recent call last):
File "\comtypes\setup.py", line 42, in <module>
from distutils.core import setup, Command, DistutilsOptionError
ImportError: cannot import name DistutilsOptionError

解决方法比较简单,给setup.py文件打上以下的patch文件:

The following patch fixes the issue:
Index: setup.py
===================================================================
--- setup.py (revision 574)
+++ setup.py (working copy)
@@ -39,7 +39,8 @@
"""
import sys, os
import ctypes
-from distutils.core import setup, Command, DistutilsOptionError
+from distutils.core import setup, Command
+from distutils.errors import DistutilsOptionError
try:
from distutils.command.build_py import build_py_2to3 as build_py

原文地址:https://www.cnblogs.com/zhangronghua/p/SolveErrorofComtypes.html