如何在MAC中运行Twisted(python)程序?
问题描述:
我在我的MAC中安装了Twisted。如何在MAC中运行Twisted(python)程序?
$ python
Python 2.7.10 (default, Oct 23 2015, 18:05:06)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import twisted
>>> twisted.__version__
'13.1.0'
>>> import OpenSSL
>>> import twisted.internet.ssl
>>> twisted.internet.ssl.SSL
<module 'OpenSSL.SSL' from '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL/SSL.so'>
>>>
我命名为test.tac
一个测试程序,我怎么能运行在MAC?我可以将它作为python脚本运行吗?
P.S:IM全新的Python的
答
如果这是一个Python脚本比是的,你可以在你的Mac上运行它。
另请参阅Twisted Documentation Page? http://twistedmatrix.com/documents/current/core/howto/index.html
我们真的需要在我们的机器上安装twistd程序吗?我只是在该tac文件中复制整个代码并创建了一个test.py文件并运行。我可以访问我的本地主机:8080页面 – Ratha
是的,如果你需要Twisted,它应该使用pip安装在你的机器上,或者创建一个virtualenv并使用pip来安装它 –