系统版本CentOS7.2
1.安装python
rpm -qa | grep python #卸载了之前的python34
yum -y install python 36
2.1安装pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
2.2 修改pip配置文件
pip3报错
Traceback (most recent call last):
File "/bin/pip3", line 7, in <module>
from pip import main
更正pip的启动文件内容如下
[root@dxt-cls1-41-217 22:08:33 ~]# cat /bin/pip3
#!/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
#from pip import main
from pip import __main__ #修改为这个
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
# sys.exit(main())
sys.exit(__main__._main()) #修改为这个
uwsgi完整报错信息
pip3 install uwsgi
Collecting uwsgi
Using cached https://files.pythonhosted.org/packages/e7/1e/3dcca007f974fe4eb369bf1b8629d5e342bb3055e2001b2e5340aaefae7a/uwsgi-2.0.18.tar.gz
Building wheels for collected packages: uwsgi
Building wheel for uwsgi (setup.py) ... error
ERROR: Complete output from command /bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-0t53yex7/uwsgi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-iy0s7zal --python-tag cp36:
ERROR: /usr/lib64/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'descriptions'
warnings.warn(msg)
running bdist_wheel
running build
running build_py
creating build
creating build/lib
copying uwsgidecorators.py -> build/lib
installing to build/bdist.linux-x86_64/wheel
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: 8
configured CFLAGS: -O2 -I. -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -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_XML -DUWSGI_XML_EXPAT -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);"
*** uWSGI compiling server core ***
[thread 2][gcc -pthread] core/utils.o
[thread 4][gcc -pthread] core/protocol.o
[thread 6][gcc -pthread] core/socket.o
[thread 5][gcc -pthread] core/logging.o
[thread 7][gcc -pthread] core/master.o
[thread 3][gcc -pthread] core/master_utils.o
[thread 0][gcc -pthread] core/emperor.o
[thread 1][gcc -pthread] core/notify.o
[thread 1][gcc -pthread] core/mule.o
[thread 4][gcc -pthread] core/subscription.o
[thread 7][gcc -pthread] core/stats.o
[thread 3][gcc -pthread] core/sendfile.o
[thread 3][gcc -pthread] core/async.o
[thread 1][gcc -pthread] core/master_checks.o
[thread 5][gcc -pthread] core/fifo.o
[thread 7][gcc -pthread] core/offload.o
[thread 3][gcc -pthread] core/io.o
[thread 6][gcc -pthread] core/static.o
[thread 4][gcc -pthread] core/websockets.o
[thread 1][gcc -pthread] core/spooler.o
[thread 5][gcc -pthread] core/snmp.o
[thread 0][gcc -pthread] core/exceptions.o
[thread 2][gcc -pthread] core/config.o
[thread 5][gcc -pthread] core/setup_utils.o
[thread 7][gcc -pthread] core/clock.o
[thread 1][gcc -pthread] core/init.o
[thread 3][gcc -pthread] core/buffer.o
[thread 4][gcc -pthread] core/reader.o
[thread 6][gcc -pthread] core/writer.o
[thread 5][gcc -pthread] core/alarm.o
[thread 0][gcc -pthread] core/cron.o
[thread 2][gcc -pthread] core/hooks.o
[thread 7][gcc -pthread] core/plugins.o
[thread 1][gcc -pthread] core/lock.o
[thread 3][gcc -pthread] core/cache.o
[thread 6][gcc -pthread] core/daemons.o
[thread 0][gcc -pthread] core/errors.o
[thread 1][gcc -pthread] core/hash.o
[thread 5][gcc -pthread] core/master_events.o
[thread 4][gcc -pthread] core/chunked.o
[thread 2][gcc -pthread] core/queue.o
[thread 7][gcc -pthread] core/event.o
[thread 1][gcc -pthread] core/signal.o
[thread 6][gcc -pthread] core/strings.o
[thread 4][gcc -pthread] core/progress.o
[thread 0][gcc -pthread] core/timebomb.o
[thread 5][gcc -pthread] core/ini.o
[thread 2][gcc -pthread] core/fsmon.o
[thread 4][gcc -pthread] core/mount.o
[thread 1][gcc -pthread] core/metrics.o
[thread 7][gcc -pthread] core/plugins_builder.o
[thread 3][gcc -pthread] core/sharedarea.o
[thread 0][gcc -pthread] core/rpc.o
[thread 6][gcc -pthread] core/gateway.o
[thread 4][gcc -pthread] core/loop.o
[thread 5][gcc -pthread] core/cookie.o
[thread 2][gcc -pthread] core/querystring.o
[thread 7][gcc -pthread] core/rb_timers.o
[thread 4][gcc -pthread] core/transformations.o
[thread 3][gcc -pthread] core/uwsgi.o
[thread 0][gcc -pthread] proto/base.o
[thread 6][gcc -pthread] proto/uwsgi.o
[thread 7][gcc -pthread] proto/http.o
[thread 2][gcc -pthread] proto/fastcgi.o
[thread 5][gcc -pthread] proto/scgi.o
[thread 4][gcc -pthread] proto/puwsgi.o
[thread 1][gcc -pthread] lib/linux_ns.o
[thread 6][gcc -pthread] core/zlib.o
[thread 4][gcc -pthread] core/regexp.o
[thread 5][gcc -pthread] core/routing.o
[thread 1][gcc -pthread] core/yaml.o
[thread 0][gcc -pthread] core/ssl.o
[thread 2][gcc -pthread] core/legion.o
[thread 7][gcc -pthread] core/xmlconf.o
[thread 4][gcc -pthread] core/dot_h.o
[thread 4][gcc -pthread] core/config_py.o
*** uWSGI compiling embedded plugins ***
[thread 4][gcc -pthread] plugins/python/python_plugin.o
[thread 1][gcc -pthread] plugins/python/pyutils.o
[thread 6][gcc -pthread] plugins/python/pyloader.o
[thread 7][gcc -pthread] plugins/python/wsgi_handlers.o
In file included from plugins/python/pyutils.c:1:0:
plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
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.
In file included from plugins/python/wsgi_handlers.c:1:0:
plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
In file included from plugins/python/pyloader.c:1:0:
plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
[thread 0][gcc -pthread] plugins/python/wsgi_headers.o
In file included from plugins/python/wsgi_headers.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: Failed building wheel for uwsgi
Running setup.py clean for uwsgi
Failed to build uwsgi
Installing collected packages: uwsgi
Running setup.py install for uwsgi ... error
ERROR: Complete output from command /bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-0t53yex7/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-6wwguquc/install-record.txt --single-version-externally-managed --compile:
ERROR: /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: 8
configured CFLAGS: -O2 -I. -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -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_XML -DUWSGI_XML_EXPAT -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);"
core/utils.o is up to date
core/protocol.o is up to date
core/socket.o is up to date
core/logging.o is up to date
*** uWSGI compiling server core ***
core/master.o is up to date
core/master_utils.o is up to date
core/emperor.o is up to date
core/notify.o is up to date
core/mule.o is up to date
core/subscription.o is up to date
core/stats.o is up to date
core/sendfile.o is up to date
core/async.o is up to date
core/master_checks.o is up to date
core/fifo.o is up to date
core/offload.o is up to date
core/io.o is up to date
core/static.o is up to date
core/websockets.o is up to date
core/spooler.o is up to date
core/snmp.o is up to date
core/exceptions.o is up to date
core/config.o is up to date
core/setup_utils.o is up to date
core/clock.o is up to date
core/init.o is up to date
core/buffer.o is up to date
core/reader.o is up to date
core/writer.o is up to date
core/alarm.o is up to date
core/cron.o is up to date
core/hooks.o is up to date
core/plugins.o is up to date
core/lock.o is up to date
core/cache.o is up to date
core/daemons.o is up to date
core/errors.o is up to date
core/hash.o is up to date
core/master_events.o is up to date
core/chunked.o is up to date
core/queue.o is up to date
core/event.o is up to date
core/signal.o is up to date
core/strings.o is up to date
core/progress.o is up to date
core/timebomb.o is up to date
core/ini.o is up to date
core/fsmon.o is up to date
core/mount.o is up to date
core/metrics.o is up to date
core/plugins_builder.o is up to date
core/sharedarea.o is up to date
core/rpc.o is up to date
core/gateway.o is up to date
core/loop.o is up to date
core/cookie.o is up to date
core/querystring.o is up to date
core/rb_timers.o is up to date
core/transformations.o is up to date
core/uwsgi.o is up to date
proto/base.o is up to date
proto/uwsgi.o is up to date
proto/http.o is up to date
proto/fastcgi.o is up to date
proto/scgi.o is up to date
proto/puwsgi.o is up to date
lib/linux_ns.o is up to date
core/zlib.o is up to date
core/regexp.o is up to date
core/routing.o is up to date
core/yaml.o is up to date
core/ssl.o is up to date
core/legion.o is up to date
core/xmlconf.o is up to date
[thread 3][gcc -pthread] core/dot_h.o
[thread 1][gcc -pthread] core/config_py.o
*** uWSGI compiling embedded plugins ***
[thread 2][gcc -pthread] plugins/python/python_plugin.o
[thread 0][gcc -pthread] plugins/python/pyutils.o
[thread 4][gcc -pthread] plugins/python/pyloader.o
[thread 6][gcc -pthread] plugins/python/wsgi_handlers.o
[thread 5][gcc -pthread] plugins/python/wsgi_headers.o
[thread 7][gcc -pthread] plugins/python/wsgi_subhandler.o
[thread 1][gcc -pthread] plugins/python/web3_subhandler.o
[thread 3][gcc -pthread] plugins/python/pump_subhandler.o
In file included from plugins/python/pyutils.c:1:0:
plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
In file included from plugins/python/wsgi_headers.c:1:0:
plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
In file included from plugins/python/wsgi_subhandler.c:1:0:
plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
In file included from plugins/python/web3_subhandler.c:1:0:
plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
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.
In file included from plugins/python/pyloader.c:1:0:
plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
In file included from plugins/python/wsgi_handlers.c:1:0:
plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
In file included from plugins/python/pump_subhandler.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 "/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-0t53yex7/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-6wwguquc/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-0t53yex7/uwsgi/
解决办法:
参考:yum install python-devel -y
参考:
使用原生wsgiref测试正常
git拉取代码或拷贝上传到项目目录
git clone https://github.com/zenthought/wemonitor.git
启动测试:
python3 manage.py runserver 0.0.0.0:8081
访问正常
使用supervisor管理进程
pip修改参考:
https://blog.csdn.net/lyll616/article/details/85090132
部署参考:https://blog.csdn.net/sinat_41898105/article/details/80897448