Chr*_*ars 3 python macos twisted
我试图在OS X Mavericks上使用twisted,但是当我尝试导入它时,我收到此错误消息.
christohersmbp2:~ christopherspears$ python
Python 2.7.6 (default, Mar 8 2014, 09:29:01)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import twisted
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named twisted
Run Code Online (Sandbox Code Playgroud)
我的猜测是我收到此错误,因为我没有使用默认的Python.我正在使用安装了brew的Python.理想情况下,我希望将其安装到虚拟环境中进行操作,但文档严重缺乏细节.显然,Mac OS X 10.5存在dmg,这对我没有帮助.我可以从tarball安装到虚拟环境中,但我不知道如何做到这一点.任何提示?
Gly*_*yph 13
如果您正在使用virtualenv,无论您是否使用系统python都无关紧要.
只需pip install twisted在你的virtualenv中,例如:
$ workon MyTwistedEnv
$ pip install twisted
Run Code Online (Sandbox Code Playgroud)
目前,由于Xcode中的一个错误影响了包含扩展模块的所有项目,您可能需要拼写这个
$ CFLAGS= pip install twisted
Run Code Online (Sandbox Code Playgroud)
代替; 希望这很快就会解决.但是,它可能不会影响brew安装的Pythons.