今天安装了Twisted,使用的时候了报ImportError(ImportError: No module named zope.interface):

细心的话,在安装Twisted的时候应该能发现,对安装是有环境需求的:

This method is only necessary if you are trying to install Twisted from e.g. the Subversion repository, and you don’t want to acquire all the tools necessary to do the Official build.

Install either Python 2.4 or Python 2.5

Install ZopeInterface 3.3.0 or later for Python

需要安装ZopeInterface。

但是如何安装这个扩展呢,在这里可以找到 zope.interface,我选择的是安装zope.interface 3.8.0,然后点击Downloads我们可以看到一堆egg的文件,以及一个Source的文件,我们选择source的文件下载,放到cygwin环境下的某个目录里下,比如说/usr/src/.

然后,使用cygwin,依次输入以下命令,即可安装完成。