背景:
安装 uwsgi时报错如下,查阅相关资料说是 python-devel的问题,于是安装之后python-devel后问题解决
报错如下:
1 (venv) [xxxxxxx]# pip install uwsgi 2 DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support 3 Looking in indexes: http://mirrors.aliyun.com/pypi/simple/ 4 Collecting uwsgi 5 Downloading http://mirrors.aliyun.com/pypi/packages/e7/1e/3dcca007f974fe4eb369bf1b8629d5e342bb3055e2001b2e5340aaefae7a/uwsgi-2.0.18.tar.gz (801kB) 6 |????????????????????????????????| 808kB 3.1MB/s 7 Building wheels for collected packages: uwsgi 8 Building wheel for uwsgi (setup.py) ... error 9 ERROR: Command errored out with exit status 1: 10 command: /xxxxxx/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-dy5kN5/uwsgi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-dy5kN5/uwsgi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"' '"'"', '"'"' '"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-BZc6P_ --python-tag cp27 11 cwd: /tmp/pip-install-dy5kN5/uwsgi/ 12 Complete output (98 lines): 13 /usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'descriptions' 14 warnings.warn(msg) 15 running bdist_wheel 16 running build 17 running build_py 18 creating build 19 creating build/lib 20 copying uwsgidecorators.py -> build/lib 21 installing to build/bdist.linux-x86_64/wheel 22 running install 23 using profile: buildconf/default.ini 24 detected include path: ['/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include', '/usr/local/include', '/usr/include'] 25 Patching "bin_name" to properly install_scripts dir 26 detected CPU cores: 1 27 configured CFLAGS: -O2 -I. -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-format -Wno-format-security -DUWSGI_HAS_IFADDRS -DUWSGI_ZLIB -DUWSGI_LOCK_USE_MUTEX -DUWSGI_EVENT_USE_EPOLL -DUWSGI_EVENT_TIMER_USE_TIMERFD -DUWSGI_EVENT_FILEMONITOR_USE_INOTIFY -DUWSGI_PCRE -DUWSGI_ROUTING -DUWSGI_VERSION=""2.0.18"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="0" -DUWSGI_VERSION_MINOR="18" -DUWSGI_VERSION_REVISION="0" -DUWSGI_VERSION_CUSTOM="""" -DUWSGI_YAML -DUWSGI_SSL -DUWSGI_PLUGIN_DIR=""."" -DUWSGI_DECLARE_EMBEDDED_PLUGINS="UDEP(python);UDEP(gevent);UDEP(ping);UDEP(cache);UDEP(nagios);UDEP(rrdtool);UDEP(carbon);UDEP(rpc);UDEP(corerouter);UDEP(fastrouter);UDEP(http);UDEP(ugreen);UDEP(signal);UDEP(syslog);UDEP(rsyslog);UDEP(logsocket);UDEP(router_uwsgi);UDEP(router_redirect);UDEP(router_basicauth);UDEP(zergpool);UDEP(redislog);UDEP(mongodblog);UDEP(router_rewrite);UDEP(router_http);UDEP(logfile);UDEP(router_cache);UDEP(rawrouter);UDEP(router_static);UDEP(sslrouter);UDEP(spooler);UDEP(cheaper_busyness);UDEP(symcall);UDEP(transformation_tofile);UDEP(transformation_gzip);UDEP(transformation_chunked);UDEP(transformation_offload);UDEP(router_memcached);UDEP(router_redis);UDEP(router_hash);UDEP(router_expires);UDEP(router_metrics);UDEP(transformation_template);UDEP(stats_pusher_socket);" -DUWSGI_LOAD_EMBEDDED_PLUGINS="ULEP(python);ULEP(gevent);ULEP(ping);ULEP(cache);ULEP(nagios);ULEP(rrdtool);ULEP(carbon);ULEP(rpc);ULEP(corerouter);ULEP(fastrouter);ULEP(http);ULEP(ugreen);ULEP(signal);ULEP(syslog);ULEP(rsyslog);ULEP(logsocket);ULEP(router_uwsgi);ULEP(router_redirect);ULEP(router_basicauth);ULEP(zergpool);ULEP(redislog);ULEP(mongodblog);ULEP(router_rewrite);ULEP(router_http);ULEP(logfile);ULEP(router_cache);ULEP(rawrouter);ULEP(router_static);ULEP(sslrouter);ULEP(spooler);ULEP(cheaper_busyness);ULEP(symcall);ULEP(transformation_tofile);ULEP(transformation_gzip);ULEP(transformation_chunked);ULEP(transformation_offload);ULEP(router_memcached);ULEP(router_redis);ULEP(router_hash);ULEP(router_expires);ULEP(router_metrics);ULEP(transformation_template);ULEP(stats_pusher_socket);" 28 *** uWSGI compiling server core *** 29 [gcc -pthread] core/utils.o 30 [gcc -pthread] core/protocol.o 31 [gcc -pthread] core/socket.o 32 [gcc -pthread] core/logging.o 33 [gcc -pthread] core/master.o 34 [gcc -pthread] core/master_utils.o 35 [gcc -pthread] core/emperor.o 36 [gcc -pthread] core/notify.o 37 [gcc -pthread] core/mule.o 38 [gcc -pthread] core/subscription.o 39 [gcc -pthread] core/stats.o 40 [gcc -pthread] core/sendfile.o 41 [gcc -pthread] core/async.o 42 [gcc -pthread] core/master_checks.o 43 [gcc -pthread] core/fifo.o 44 [gcc -pthread] core/offload.o 45 [gcc -pthread] core/io.o 46 [gcc -pthread] core/static.o 47 [gcc -pthread] core/websockets.o 48 [gcc -pthread] core/spooler.o 49 [gcc -pthread] core/snmp.o 50 [gcc -pthread] core/exceptions.o 51 [gcc -pthread] core/config.o 52 [gcc -pthread] core/setup_utils.o 53 [gcc -pthread] core/clock.o 54 [gcc -pthread] core/init.o 55 [gcc -pthread] core/buffer.o 56 [gcc -pthread] core/reader.o 57 [gcc -pthread] core/writer.o 58 [gcc -pthread] core/alarm.o 59 [gcc -pthread] core/cron.o 60 [gcc -pthread] core/hooks.o 61 [gcc -pthread] core/plugins.o 62 [gcc -pthread] core/lock.o 63 [gcc -pthread] core/cache.o 64 [gcc -pthread] core/daemons.o 65 [gcc -pthread] core/errors.o 66 [gcc -pthread] core/hash.o 67 [gcc -pthread] core/master_events.o 68 [gcc -pthread] core/chunked.o 69 [gcc -pthread] core/queue.o 70 [gcc -pthread] core/event.o 71 [gcc -pthread] core/signal.o 72 [gcc -pthread] core/strings.o 73 [gcc -pthread] core/progress.o 74 [gcc -pthread] core/timebomb.o 75 [gcc -pthread] core/ini.o 76 [gcc -pthread] core/fsmon.o 77 [gcc -pthread] core/mount.o 78 [gcc -pthread] core/metrics.o 79 [gcc -pthread] core/plugins_builder.o 80 [gcc -pthread] core/sharedarea.o 81 [gcc -pthread] core/rpc.o 82 [gcc -pthread] core/gateway.o 83 [gcc -pthread] core/loop.o 84 [gcc -pthread] core/cookie.o 85 [gcc -pthread] core/querystring.o 86 [gcc -pthread] core/rb_timers.o 87 [gcc -pthread] core/transformations.o 88 [gcc -pthread] core/uwsgi.o 89 [gcc -pthread] proto/base.o 90 [gcc -pthread] proto/uwsgi.o 91 [gcc -pthread] proto/http.o 92 [gcc -pthread] proto/fastcgi.o 93 [gcc -pthread] proto/scgi.o 94 [gcc -pthread] proto/puwsgi.o 95 [gcc -pthread] lib/linux_ns.o 96 [gcc -pthread] core/zlib.o 97 [gcc -pthread] core/regexp.o 98 [gcc -pthread] core/routing.o 99 [gcc -pthread] core/yaml.o 100 [gcc -pthread] core/ssl.o 101 [gcc -pthread] core/legion.o 102 [gcc -pthread] core/dot_h.o 103 [gcc -pthread] core/config_py.o 104 *** uWSGI compiling embedded plugins *** 105 [gcc -pthread] plugins/python/python_plugin.o 106 In file included from plugins/python/python_plugin.c:1:0: 107 plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory 108 #include <Python.h> 109 ^ 110 compilation terminated. 111 ---------------------------------------- 112 ERROR: Failed building wheel for uwsgi 113 Running setup.py clean for uwsgi 114 Failed to build uwsgi 115 Installing collected packages: uwsgi 116 Running setup.py install for uwsgi ... error 117 ERROR: Command errored out with exit status 1: 118 command: /xxxxxxxx/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-dy5kN5/uwsgi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-dy5kN5/uwsgi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"' '"'"', '"'"' '"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-z3qq7P/install-record.txt --single-version-externally-managed --compile --install-headers /xxxxxxxx/include/site/python2.7/uwsgi 119 cwd: /tmp/pip-install-dy5kN5/uwsgi/ 120 Complete output (91 lines): 121 /usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'descriptions' 122 warnings.warn(msg) 123 running install 124 using profile: buildconf/default.ini 125 detected include path: ['/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include', '/usr/local/include', '/usr/include'] 126 Patching "bin_name" to properly install_scripts dir 127 detected CPU cores: 1 128 configured CFLAGS: -O2 -I. -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-format -Wno-format-security -DUWSGI_HAS_IFADDRS -DUWSGI_ZLIB -DUWSGI_LOCK_USE_MUTEX -DUWSGI_EVENT_USE_EPOLL -DUWSGI_EVENT_TIMER_USE_TIMERFD -DUWSGI_EVENT_FILEMONITOR_USE_INOTIFY -DUWSGI_PCRE -DUWSGI_ROUTING -DUWSGI_VERSION=""2.0.18"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="0" -DUWSGI_VERSION_MINOR="18" -DUWSGI_VERSION_REVISION="0" -DUWSGI_VERSION_CUSTOM="""" -DUWSGI_YAML -DUWSGI_SSL -DUWSGI_PLUGIN_DIR=""."" -DUWSGI_DECLARE_EMBEDDED_PLUGINS="UDEP(python);UDEP(gevent);UDEP(ping);UDEP(cache);UDEP(nagios);UDEP(rrdtool);UDEP(carbon);UDEP(rpc);UDEP(corerouter);UDEP(fastrouter);UDEP(http);UDEP(ugreen);UDEP(signal);UDEP(syslog);UDEP(rsyslog);UDEP(logsocket);UDEP(router_uwsgi);UDEP(router_redirect);UDEP(router_basicauth);UDEP(zergpool);UDEP(redislog);UDEP(mongodblog);UDEP(router_rewrite);UDEP(router_http);UDEP(logfile);UDEP(router_cache);UDEP(rawrouter);UDEP(router_static);UDEP(sslrouter);UDEP(spooler);UDEP(cheaper_busyness);UDEP(symcall);UDEP(transformation_tofile);UDEP(transformation_gzip);UDEP(transformation_chunked);UDEP(transformation_offload);UDEP(router_memcached);UDEP(router_redis);UDEP(router_hash);UDEP(router_expires);UDEP(router_metrics);UDEP(transformation_template);UDEP(stats_pusher_socket);" -DUWSGI_LOAD_EMBEDDED_PLUGINS="ULEP(python);ULEP(gevent);ULEP(ping);ULEP(cache);ULEP(nagios);ULEP(rrdtool);ULEP(carbon);ULEP(rpc);ULEP(corerouter);ULEP(fastrouter);ULEP(http);ULEP(ugreen);ULEP(signal);ULEP(syslog);ULEP(rsyslog);ULEP(logsocket);ULEP(router_uwsgi);ULEP(router_redirect);ULEP(router_basicauth);ULEP(zergpool);ULEP(redislog);ULEP(mongodblog);ULEP(router_rewrite);ULEP(router_http);ULEP(logfile);ULEP(router_cache);ULEP(rawrouter);ULEP(router_static);ULEP(sslrouter);ULEP(spooler);ULEP(cheaper_busyness);ULEP(symcall);ULEP(transformation_tofile);ULEP(transformation_gzip);ULEP(transformation_chunked);ULEP(transformation_offload);ULEP(router_memcached);ULEP(router_redis);ULEP(router_hash);ULEP(router_expires);ULEP(router_metrics);ULEP(transformation_template);ULEP(stats_pusher_socket);" 129 *** uWSGI compiling server core *** 130 core/utils.o is up to date 131 core/protocol.o is up to date 132 core/socket.o is up to date 133 core/logging.o is up to date 134 core/master.o is up to date 135 core/master_utils.o is up to date 136 core/emperor.o is up to date 137 core/notify.o is up to date 138 core/mule.o is up to date 139 core/subscription.o is up to date 140 core/stats.o is up to date 141 core/sendfile.o is up to date 142 core/async.o is up to date 143 core/master_checks.o is up to date 144 core/fifo.o is up to date 145 core/offload.o is up to date 146 core/io.o is up to date 147 core/static.o is up to date 148 core/websockets.o is up to date 149 core/spooler.o is up to date 150 core/snmp.o is up to date 151 core/exceptions.o is up to date 152 core/config.o is up to date 153 core/setup_utils.o is up to date 154 core/clock.o is up to date 155 core/init.o is up to date 156 core/buffer.o is up to date 157 core/reader.o is up to date 158 core/writer.o is up to date 159 core/alarm.o is up to date 160 core/cron.o is up to date 161 core/hooks.o is up to date 162 core/plugins.o is up to date 163 core/lock.o is up to date 164 core/cache.o is up to date 165 core/daemons.o is up to date 166 core/errors.o is up to date 167 core/hash.o is up to date 168 core/master_events.o is up to date 169 core/chunked.o is up to date 170 core/queue.o is up to date 171 core/event.o is up to date 172 core/signal.o is up to date 173 core/strings.o is up to date 174 core/progress.o is up to date 175 core/timebomb.o is up to date 176 core/ini.o is up to date 177 core/fsmon.o is up to date 178 core/mount.o is up to date 179 core/metrics.o is up to date 180 core/plugins_builder.o is up to date 181 core/sharedarea.o is up to date 182 core/rpc.o is up to date 183 core/gateway.o is up to date 184 core/loop.o is up to date 185 core/cookie.o is up to date 186 core/querystring.o is up to date 187 core/rb_timers.o is up to date 188 core/transformations.o is up to date 189 core/uwsgi.o is up to date 190 proto/base.o is up to date 191 proto/uwsgi.o is up to date 192 proto/http.o is up to date 193 proto/fastcgi.o is up to date 194 proto/scgi.o is up to date 195 proto/puwsgi.o is up to date 196 lib/linux_ns.o is up to date 197 core/zlib.o is up to date 198 core/regexp.o is up to date 199 core/routing.o is up to date 200 core/yaml.o is up to date 201 core/ssl.o is up to date 202 core/legion.o is up to date 203 [gcc -pthread] core/dot_h.o 204 [gcc -pthread] core/config_py.o 205 *** uWSGI compiling embedded plugins *** 206 [gcc -pthread] plugins/python/python_plugin.o 207 In file included from plugins/python/python_plugin.c:1:0: 208 plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory 209 #include <Python.h> 210 ^ 211 compilation terminated. 212 ---------------------------------------- 213 ERROR: Command errored out with exit status 1: /xxxxxxx/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-dy5kN5/uwsgi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-dy5kN5/uwsgi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"' '"'"', '"'"' '"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-z3qq7P/install-record.txt --single-version-externally-managed --compile --install-headers /xxxxxxxx/include/site/python2.7/uwsgi Check the logs for full command output.
解决:
安装 python-devel
1 yum install python-devel
安装完成后再安装 uwsgi,成功安装
1 pip install uwsgi
更新: