【问题标题】:Install twisted for python failed on Lion在 Lion 上安装 twisted for python 失败
【发布时间】:2012-07-07 01:59:01
【问题描述】:

我想在我的 macbook 上安装 twisted。

System version: Mac OS X Lion 10.7.4
Xcode version: Version 4.3.3 (4E3002)

Python 版本:

Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

当我运行这个时:

sudo easy_install twisted

它失败了:

Processing Twisted-12.1.0.tar.bz2

Running Twisted-12.1.0/setup.py -q bdist_egg --dist-dir /tmp/easy_installdtZ7Lk/Twisted-12.1.0/egg-dist-tmp-NUWexg

unable to execute gcc-4.2: No such file or directory

...

error: Setup script exited with error: command 'gcc-4.2' failed with exit status 1

但我确实安装了 gcc:

gcc --version 

i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)

Copyright (C) 2007 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

谁能帮帮我?

帖子: 问题由此解决:

which gcc
/usr/bin/gcc
cd /usr/bin
ln gcc gcc-4.2

【问题讨论】:

    标签: python xcode macos twisted easy-install


    【解决方案1】:
    1. Twisted 是 OS X 自带的,所以你不需要这样做;假设 11.0 是可接受的版本(这就是 Lion 中的内容)。只需>>> import twisted 即可。

    2. 永远,永远不会在任何平台上进行 sudo easy_install 任何事情,也许 virtualenvpip 除外。 easy_install 没有卸载功能,它不能给你它安装的文件的列表。 pip install 稍微好一点,但最好避免在全局系统中安装任何东西;系统本身的组件可能会使用某些 Python 库,安装新版本可能不完全兼容。

    【讨论】:

    • +1 关于“不要easy_install”提示,话虽如此,我发现一些库无法使用pip 安装,但可以通过easy_install 工作(例如:@ 987654330@).
    • 嗯 - Mountain Lion 似乎没有可用的扭曲版本 - 不适合我。符号链接 gcc 也没有帮助。
    猜你喜欢
    • 2012-01-27
    • 2013-11-05
    • 2012-05-16
    • 2013-09-12
    • 1970-01-01
    • 2011-12-25
    • 2016-07-01
    • 1970-01-01
    • 2013-09-24
    相关资源
    最近更新 更多