安装uwsgi 报错问题解决

举报
Yuchuan 发表于 2020/09/06 10:41:57 2020/09/06
【摘要】 uwsgi 安装失败原因分析及解决方案

在安装uwsgi 时报错:

image.png

 ERROR: Command errored out with exit status 1:
     command: /home/yuchuan/bin/virtualenv/proenv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zxwetjyh/uwsgi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zxwetjyh/uwsgi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-07qonhkc/install-record.txt --single-version-externally-managed --compile --install-headers /home/yuchuan/bin/virtualenv/proenv/include/site/python3.6/uwsgi
         cwd: /tmp/pip-install-zxwetjyh/uwsgi/
    Complete output (86 lines):
    /usr/lib64/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'descriptions'
      warnings.warn(msg)
    running install
    using profile: buildconf/default.ini
    detected include path: ['/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include', '/usr/local/include', '/usr/include']
    Patching "bin_name" to properly install_scripts dir
    detected CPU cores: 1
    configured CFLAGS: -O2 -I. -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-format
    *** uWSGI compiling server core ***
    [gcc -pthread] core/utils.o
    [gcc -pthread] core/protocol.o
    [gcc -pthread] core/socket.o
    [gcc -pthread] core/logging.o
    [gcc -pthread] core/master.o
    [gcc -pthread] core/master_utils.o
    [gcc -pthread] core/emperor.o
    [gcc -pthread] core/notify.o
    [gcc -pthread] core/mule.o
    *** uWSGI compiling embedded plugins ***
    [gcc -pthread] plugins/python/python_plugin.o
    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 <Python.h>
                        ^
    compilation terminated.
    ERROR: Command errored out with exit status 1: /home/yuchuan/bin/virtualenv/proenv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zxwetjyh/uwsgi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zxwetjyh/uwsgi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-07qonhkc/install-record.txt --single-version-externally-managed --compile --install-headers /home/yuchuan/bin/virtualenv/proenv/include/site/python3.6/uwsgi Check the logs for full command output.

原因分析:

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

我正在将Anaconda用于python3。我与OP发生了相同的错误(由“ LTO版本”引起),结果我必须安装不同的编译器:

解决方案:

(proenv) [root@TXMaster edupro]# yum install gcc python36-devel

安装相关依赖后再安装uwsgi

(proenv) [yuchuan@TXMaster edupro]$ pip install uwsgi
Collecting uwsgi
  Using cached uWSGI-2.0.19.1.tar.gz (803 kB)
Using legacy 'setup.py install' for uwsgi, since package 'wheel' is not installed.
Installing collected packages: uwsgi
    Running setup.py install for uwsgi ... done
Successfully installed uwsgi-2.0.19.1
(proenv) [yuchuan@TXMaster edupro]$ ll

成功安装。

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。