在Lion上安装twred for python失败

use*_*141 2 python macos xcode twisted easy-install

我想在我的macbook上安装twis​​ted.

System version: Mac OS X Lion 10.7.4
Xcode version: Version 4.3.3 (4E3002)
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

当我运行这个:

sudo easy_install twisted
Run Code Online (Sandbox Code Playgroud)

它失败了:

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
Run Code Online (Sandbox Code Playgroud)

但我确实安装了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.
Run Code Online (Sandbox Code Playgroud)

任何人都可以帮助我吗?

发布:问题由此解决:

which gcc
/usr/bin/gcc
cd /usr/bin
ln gcc gcc-4.2
Run Code Online (Sandbox Code Playgroud)

Gly*_*yph 8

  1. Twisted随OS X一起提供,所以你不需要这样做; 假设11.0是可接受的版本(这就是Lion中的内容).只是>>> import twisted去.

  2. 永远不要sudo easy_install任何东西,在任何平台上,除非,也许,virtualenv中点子. easy_install没有卸载功能,它无法为您提供其安装的文件列表. pip install稍微好一点,但最好是避免在您的全球系统中安装任何东西; 系统本身的组件可能使用某些Python库,安装新版本可能不完全兼容.