加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python – 在OS X Mavericks上使用扭曲

发布时间:2020-12-20 12:30:58 所属栏目:Python 来源:网络整理
导读:我试图在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","
我试图在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

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

解决方法

如果你正在使用virtualenv,那么你是否使用系统python并不重要.

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

$workon MyTwistedEnv
$pip install twisted

目前,due to a bug in Xcode that affects all projects which contain extension modules,你可能需要拼写这个

$CFLAGS= pip install twisted

代替;希望这很快就会解决.但是,它可能不会影响brew安装的Pythons.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读