python - 在/tmp/pip_build_root/uwsgi 中编译失败,错误代码为 1

标签 python ubuntu uwsgi

我正尝试按照 http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html 上的教程进行操作.我已经将所有工作都归结为 http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html#install-uwsgi-system-wide。我在亚马逊 EC2 上使用 ubuntu 14.4 实例:

没有进入我的 virtualenv ,我跑了:

sudo pip install uwsgi 

这导致:

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/uwsgi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-64P2dl-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/uwsgi
Storing debug log for failure in /home/ubuntu/.pip/pip.log

日志有:

Cleaning up...
  Removing temporary dir /tmp/pip_build_ubuntu...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-uLEPHb-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-hPh8D0-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-uLEPHb-build
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 706, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-uLEPHb-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-hPh8D0-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-uLEPHb-build

我做错了什么?

最佳答案

回答您的问题可能有点晚,但提出我的回答可以帮助以后的人。

我回头看了看日志,看到了这些行。

[x86_64-linux-gnu-gcc -In file included from plugins/python/python_plugin.c:1:0:
plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
 #include 
                   ^
compilation terminated.

原来是找不到Python.h。安装 python2.7-dev 为我解决了这个问题。

apt-get install -y python2.7-dev

关于python - 在/tmp/pip_build_root/uwsgi 中编译失败,错误代码为 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29640868/

相关文章:

python - 如何通过 sphinx 链接到 Python 3 文档中的类型 contextmanager 标签

python - PyMC3:分层橄榄球模型后验?

python - 使用 createContentInContainer 创建内容

json - 使用 jq 更新 JSON 文件时缺少内容

ssl.SSLError : [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl. c:645)

nginx - 在正常信号下,nginx 在尝试连接到 uWSGI 套接字时抛出连接被拒绝

python - 使用 Python Twisted 时没有看到 'Unhandled error in Deferred' 的堆栈跟踪

Postgresql - 不存在 PostgreSQL 集群;在服务重启期间看到 "man pg_createcluster"

ubuntu - 支持自动换行/换行的 Linux 图形 difftool

docker 中的 django + uwsgi