通过pip安装uwsgi 1.2.5


22

欢迎,

目前,我正在根据网站http://projects.unbit.it/uwsgi/wiki/Quickstart上的说明,尝试在VPS(Ubuntu 11.10)上安装最新的uwsgi。

pip install uwsgi

在编译期间,我看到一些错误:

...
[gcc -pthread] spooler.o
*** uWSGI compiling embedded plugins ***
[gcc -pthread] plugins/python/python_plugin.o
Complete output from command /usr/bin/python -c "import setuptools;__file__='/etc/apt/sources.list.d/build/uwsgi/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-joud1I-record/install-record.txt:
running install

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

compilation terminated.

using profile: buildconf/default.ini

detected include path: ['/usr/lib/gcc/i686-linux-gnu/4.6.1/include','/usr/local/include', '/usr/lib/gcc/i686-linux-gnu/4.6.1/include-fixed', '/usr/include/i386-linux-gnu', '/usr/include']

Patching "bin_name" to properly install_scripts dir
...

最后我看到:

...

[gcc -pthread] spooler.o

*** uWSGI compiling embedded plugins ***

[gcc -pthread] plugins/python/python_plugin.o

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/etc/apt/sources.list.d/build/uwsgi/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-joud1I-record/install-record.txt failed with error code 1 in /etc/apt/sources.list.d/build/uwsgi
Storing complete log in /root/.pip/pip.log

有没有人建议如何安装最新的uwsgi?

此致Grzegorz


1
遵循上述所有建议后的结果是,我应该以root用户身份运行命令而不是运行pip3 install uwsgi:sudo pip3 install
uwsgi

Answers:


38

plugins / python / uwsgi_python.h:2:20:致命错误:Python.h:无此类文件或目录

要为Python编译C扩展,您需要Python开发文件:

$ sudo apt-get install python2.7-dev

@JFSebastian:请看看相关的askubuntu.com/q/499206/306605。谢谢。
pepr


在使用Python 3.4的Debian Wheezy上发生了相同的错误,这有所帮助,谢谢!
fnkr

一个已经python2.7-dev安装,仍然看到错误
yentsun

1

万一其他人遇到此问题,这里也将是这样-即使我们已经成功安装了python2.7-dev,我们仍然会收到此错误。

问题显然出在gcc无法找到试图运行的构建脚本pip中包含的库。

我们实际上最终得到了uwsgi pip zip:https ://pypi.python.org/packages/source/u/uWSGI/uwsgi-1.9.20.tar.gz

然后按照以下步骤手动进行更改-

首先,我们将其解压缩:

$ tar xvzf uwsgi-1.9.20.tar.gz

他们,我们编辑了文件:uwsgiconfig.py,替换了第213行:

cmdline = "%s -c %s -o %s %s" % (GCC, cflags, objfile, srcfile)

至:

cmdline = "%s -I/usr/include/libxml2 -c %s -o %s %s" % (GCC, cflags, objfile, srcfile)

基本上,让gcc知道您的库在/usr/include/libxml2(至少是我们的情况)

之后,我们重新压缩文件夹:

$ tar cvf uwsgi-1.9.20.tar uwsgi-1.9.20/

$ gzip uwsgi-1.9.20.tar

并使用带有该gzip的点:

$ sudo pip install uwsgi-1.9.20.tar.gz

那行得通..

希望能对某人有所帮助!


如果找不到通过标准软件包安装的标头,则您的gcc安装会中断
jfs

0

要通过安装在Cygwin下pip,需要以下软件包:

  • gcc核心
  • gcc-g ++(可能)
  • libcrypt开发
  • libintl-开发
  • python3
  • python3-devel
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.