Centos pip 安裝uwsgi 報錯“fatal error: Python.h: No such file or directory”


  flask項目寫到一半,准備試着放在服務器上跑跑,一想生產環境不能用 app.run(),百度了一下要使用Ngix+uwsgi。

  本着一路pip的原則,首先來了一個漂亮的

pip3 install uwsgi

  不幸報錯

[gcc -pthread] core/zlib.o
    [gcc -pthread] core/regexp.o
    [gcc -pthread] core/routing.o
    [gcc -pthread] core/yaml.o
    [gcc -pthread] core/ssl.o
    [gcc -pthread] core/legion.o
    [gcc -pthread] core/xmlconf.o
    [gcc -pthread] core/dot_h.o
    [gcc -pthread] core/config_py.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.

    ----------------------------------------
Command "/usr/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dsr9i4nq/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-9835ofpr-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-dsr9i4nq/uwsgi/

  一看找不到python.h,肯定是依賴問題,網上一搜,基本答案都是安裝 python-dev  和 build-essential,我試着yum了一下,發現居然沒有找到包

[root@VM_0_13_centos python3]# yum install python-dev
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
No package python-dev available.
Error: Nothing to do

  想想自己是python3,換個姿勢

[root@VM_0_13_centos python3]# yum install python3-dev
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
No package python3-dev available.
Error: Nothing to do
[root@VM_0_13_centos python3]# yum install python34-dev
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
No package python34-dev available.
Error: Nothing to do

  這就迷了

  后來無意中翻到 http://blog.csdn.net/dingqingsong/article/details/77651414 ,雖然報錯不太一致,但好歹都是 找不到 <python.h>

  

yum install python34-devel

  安裝完后,接着pip安裝uwsgi,一路順風。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM