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. I am using a Python installed with brew. 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. I can install from the tarball into the virtual environment, but I am not sure how to do this. Any hints?

我的猜测是我收到此错误,因为我没有使用默认的Python。我正在使用安装了brew的Python。理想情况下,我希望将其安装到虚拟环境中进行操作,但文档严重缺乏细节。显然,Mac OS X 10.5存在dmg,这对我没有帮助。我可以从tarball安装到虚拟环境中,但我不知道该怎么做。任何提示?

1 个解决方案

#1


13

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:

只需将你的virtualenv中的pip install扭曲,就像:

$ 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。

更多相关文章

  1. 在CentOS 6.3 64bit上搭建python高性能框架gevent开发环境
  2. python环境配置问题及解决办法集锦
  3. 获取错误“ValueError:int()的无效文字,基数为10:'3128;'在运行Tensor
  4. GIS / Gdal / OSGeos在Windows上的django中导入错误
  5. Python第十天 print >> f,和fd.write()的区别 stdout的buffer 标
  6. Hive中使用Python实现Transform时遇到Broken pipe错误排查
  7. 'module'对象没有属性'views' django错误
  8. Windows7下搭建Django运行环境
  9. Python 3基础教程1-环境安装和运行环境

随机推荐

  1. android插件apk杂记
  2. Android记录4--自定义ToggleButton+用Sha
  3. 如何将.net DateTime作为json字符串解析
  4. 实现Linux/Android双系统启动和重启切换
  5. 完美解决EditText和ScrollView的滚动冲突
  6. Android项目实战--手机卫士01--启动界面
  7. 关于Android的JNI(一)
  8. 将ListView拉伸到单个屏幕?
  9. android 识别身份证
  10. 第三部分:Android 应用程序接口指南---第