我需要uWSGI来运行django项目。因此,当我尝试安装uWSGI时,它给我一个错误说“异常:你需要一个C编译器来构建uWSGI”。但mac带有gcc编译器。
我从“http://projects.unbit.it/uwsgi/wiki/WikiStart#Getit”下载了uWSGI,并尝试通过命令“python setup.py install”进行安装
这是我在安装uWSGI时遇到的错误
running install
using profile: buildconf/default.ini
detected include path: ['/usr/local/include', '/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple
darwin11/4.2.1/include', '/usr/include', '/System/Library/Frameworks', '/Library/Frameworks']
Traceback (most recent call last):
File "setup.py", line 98, in <module>
distclass=uWSGIDistribution,
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py",
line 152, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py",
line 953, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py",
line 972, in run_command
cmd_obj.run()
File "setup.py", line 61, in run
conf = uc.uConf(get_profile())
File "/Users/jay/Downloads/Softwares/Work/uwsgi-1.2.4/uwsgiconfig.py", line 340, in __init__
raise Exception("you need a C compiler to build uWSGI")
Exception: you need a C compiler to build uWSGI
答案 0 :(得分:38)
已经安装了gcc,只需导出CC = gcc即可。
答案 1 :(得分:17)
distutils可能会返回类似“gcc-4.2”而不是普通的旧“gcc”。
使用sudo等,你可能想做这样的事情:
sudo CC=gcc pip install uwsgi
答案 2 :(得分:0)
安装CommandLine工具
$pip install uwsgi
然后运行
add_filter( 'product_type_selector', 'so_42835590_add_product_type' );
function so_42835590_add_product_type( $types ){
// Key should be exactly the same as in the class product_type parameter
$types[ 'gift-card' ] = __( 'Gift Card', 'your-plugin' );
return $types;
}
答案 3 :(得分:0)
首先安装gcc编译器
xcode-select --install
答案 4 :(得分:0)
在Mac中安装Xcode,而不要在Xcode首选项中选择命令行工具。通过pip install uwsgi对我有用