简体   繁体   English

在OS X Mavericks上使用扭曲

[英]Using twisted on OS X Mavericks

I am trying to use twisted on OS X Mavericks, but I get this error message when I try to import it. 我试图在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

My guess is that I am receiving this error because I am not using the default Python. 我的猜测是我收到此错误,因为我没有使用默认的Python。 I am using a Python installed with brew. 我正在使用安装了brew的Python。 Ideally, I would want to install twisted into a virtual environment to play with, but the docs are seriously lacking in details. 理想情况下,我希望将其安装到虚拟环境中进行操作,但文档严重缺乏细节。 Apparently, a dmg exists for Mac OS X 10.5, which is not helpful for me. 显然,Mac OS X 10.5存在dmg,这对我没有帮助。 I can install from the tarball into the virtual environment, but I am not sure how to do this. 我可以从tarball安装到虚拟环境中,但我不知道如何做到这一点。 Any hints? 任何提示?

If you're using virtualenv , it doesn't matter whether you are using the system python or not. 如果你正在使用virtualenv ,那么你是否使用系统python并不重要。

Simply pip install twisted in your virtualenv, like: 只需pip install twisted你的virtualenv中的pip install twisted ,就像:

$ workon MyTwistedEnv
$ pip install twisted

Currently, due to a bug in Xcode that affects all projects which contain extension modules , you may need to spell this 目前, 由于Xcode中的一个错误影响了包含扩展模块的所有项目 ,您可能需要拼写这个

$ CFLAGS= pip install twisted

instead; 代替; hopefully this will be fixed soon. 希望这很快就会解决。 It may not affect brew installed Pythons, however. 但是,它可能不会影响brew安装的Pythons。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM