flask項目寫到一半,準備試着放在服務器上跑跑,一想生產環境不能用 app.run(),百度了一下要使用Ngix+uwsgi。python
本着一路pip的原則,首先來了一個漂亮的flask
pip3 install uwsgi
不幸報錯centos
[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了一下,發現竟然沒有找到包bash
[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
這就迷了app
後來無心中翻到 http://blog.csdn.net/dingqingsong/article/details/77651414 ,雖然報錯不太一致,但好歹都是 找不到 <python.h>ui
yum install python34-devel
安裝完後,接着pip安裝uwsgi,一帆風順。.net