Amazon Linux EC2实例上的uWSGI安装例外

kur*_*o42 5 django nginx amazon-ec2 uwsgi

我是一个新手,尝试使用nginx,django,uWSGI和mySQL在Amazon EC2上为我的第一个手机应用程序设置服务器.

我正在关注这些教程(实际上第二个是基于第一个):

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html http://www.oliverelliott.org/article/computing/tut_setup_nginx_django/

我正在使用MacbookPro,一旦进入终端,我就会进入Amazon Linux EC2实例.当谈到安装uwsgi..troubles出现.我执行了:

$ sudo yum install python-pip
$ sudo yum install python-devel
$ sudo pip install uwsgi
Run Code Online (Sandbox Code Playgroud)

前两个工作正常,最后一个命令抛出异常:

    Downloading/unpacking uwsgi
  Running setup.py egg_info for package uwsgi
Installing collected packages: uwsgi
  Running setup.py install for uwsgi
    using profile: buildconf/default.ini
    detected include path: ['/usr/include', '/usr/local/include']
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-root/uwsgi/setup.py", line 109, in <module>
        distclass=uWSGIDistribution,
      File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup
        dist.run_commands()
      File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands
        self.run_command(cmd)
      File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-root/uwsgi/setup.py", line 71, in run
        conf = uc.uConf(get_profile())
      File "uwsgiconfig.py", line 687, in __init__
        raise Exception("you need a C compiler to build uWSGI")
    Exception: you need a C compiler to build uWSGI
    Complete output from command /usr/bin/python26 -c "import setuptools;__file__='/tmp/pip-build-root/uwsgi/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-l8npX4-record/install-record.txt --single-version-externally-managed:
    running install

using profile: buildconf/default.ini

detected include path: ['/usr/include', '/usr/local/include']

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/tmp/pip-build-root/uwsgi/setup.py", line 109, in <module>

    distclass=uWSGIDistribution,

  File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup

    dist.run_commands()

  File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands

    self.run_command(cmd)

  File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command

    cmd_obj.run()

  File "/tmp/pip-build-root/uwsgi/setup.py", line 71, in run

    conf = uc.uConf(get_profile())

  File "uwsgiconfig.py", line 687, in __init__

    raise Exception("you need a C compiler to build uWSGI")

Exception: you need a C compiler to build uWSGI

----------------------------------------
Command /usr/bin/python26 -c "import setuptools;__file__='/tmp/pip-build-root/uwsgi/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-l8npX4-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-root/uwsgi
Storing complete log in /root/.pip/pip.log
Run Code Online (Sandbox Code Playgroud)

我已经尝试了两个我读过的建议,但似乎对我不起作用:

$ export CC=gcc && pip install -r requirements.txt 
Run Code Online (Sandbox Code Playgroud)

$ sudo CC=gcc pip install uwsgi
Run Code Online (Sandbox Code Playgroud)

有什么建议?非常感谢提前!!

Den*_*nov 12

我通过以下链接获得了帮助:uWSGI:从分发包安装

我做了:

yum groupinstall "Development Tools"
yum install python-devel
Run Code Online (Sandbox Code Playgroud)

然后:

pip install uwsgi
Run Code Online (Sandbox Code Playgroud)

之后它起作用了.