python环境配置

有个chatserver.py文件写的服务器代码,mac下终端执行python  chatserver.py 总是报上面的错,求解

ImportError: No module named twisted.internet.protocol


解决办法:

I figured out why this error was happening. For some reason, using apt-get to install a python package was not installing it right.

So, I had to download a tar ball and install the package from them.

I downloaded Twisted tar from here.//下载

I did a tar xjf Twisted-13.1.0.tar.bz2 - this created a directory called Twisted-13.1.0.//解压

next, cd Twisted-13.1.0 //到解压目录

Finally, sudo python setup.py install // 运行

This gave me an error. Twisted required another package called zope.interface.

So, I downloaded tar ball for zope.interface from here. //下载

Then, ran this command tar xzf zope.interface-3.6.1.tar.gz That created a folder called zope.interface-3.6.1. //解压

So, cd into zope.interface-3.6.1 and run sudo python setup.py install //运行

Note: Depending on your user's rights, you may want to do these commands in sudo mode. Just add the keyword sudo before every command.

原文地址:https://www.cnblogs.com/oc-bowen/p/5262099.html