当前位置:   article > 正文

django线上环境配置_in file included from plugins/python/wsgi_handlers

in file included from plugins/python/wsgi_handlers.c:1:

系统版本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报错

  1. Traceback (most recent call last):
  2. File "/bin/pip3", line 7, in <module>
  3. from pip import main

更正pip的启动文件内容如下

  1. [root@dxt-cls1-41-217 22:08:33 ~]# cat /bin/pip3
  2. #!/bin/python3
  3. # -*- coding: utf-8 -*-
  4. import re
  5. import sys
  6. #from pip import main
  7. from pip import __main__ #修改为这个
  8. if __name__ == '__main__':
  9. sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
  10. # sys.exit(main())
  11. sys.exit(__main__._main()) #修改为这个

 

 

uwsgi完整报错信息

  1. pip3 install uwsgi
  2. Collecting uwsgi
  3. Using cached https://files.pythonhosted.org/packages/e7/1e/3dcca007f974fe4eb369bf1b8629d5e342bb3055e2001b2e5340aaefae7a/uwsgi-2.0.18.tar.gz
  4. Building wheels for collected packages: uwsgi
  5. Building wheel for uwsgi (setup.py) ... error
  6. 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:
  7. ERROR: /usr/lib64/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'descriptions'
  8. warnings.warn(msg)
  9. running bdist_wheel
  10. running build
  11. running build_py
  12. creating build
  13. creating build/lib
  14. copying uwsgidecorators.py -> build/lib
  15. installing to build/bdist.linux-x86_64/wheel
  16. running install
  17. using profile: buildconf/default.ini
  18. detected include path: ['/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include', '/usr/local/include', '/usr/include']
  19. Patching "bin_name" to properly install_scripts dir
  20. detected CPU cores: 8
  21. 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);"
  22. *** uWSGI compiling server core ***
  23. [thread 2][gcc -pthread] core/utils.o
  24. [thread 4][gcc -pthread] core/protocol.o
  25. [thread 6][gcc -pthread] core/socket.o
  26. [thread 5][gcc -pthread] core/logging.o
  27. [thread 7][gcc -pthread] core/master.o
  28. [thread 3][gcc -pthread] core/master_utils.o
  29. [thread 0][gcc -pthread] core/emperor.o
  30. [thread 1][gcc -pthread] core/notify.o
  31. [thread 1][gcc -pthread] core/mule.o
  32. [thread 4][gcc -pthread] core/subscription.o
  33. [thread 7][gcc -pthread] core/stats.o
  34. [thread 3][gcc -pthread] core/sendfile.o
  35. [thread 3][gcc -pthread] core/async.o
  36. [thread 1][gcc -pthread] core/master_checks.o
  37. [thread 5][gcc -pthread] core/fifo.o
  38. [thread 7][gcc -pthread] core/offload.o
  39. [thread 3][gcc -pthread] core/io.o
  40. [thread 6][gcc -pthread] core/static.o
  41. [thread 4][gcc -pthread] core/websockets.o
  42. [thread 1][gcc -pthread] core/spooler.o
  43. [thread 5][gcc -pthread] core/snmp.o
  44. [thread 0][gcc -pthread] core/exceptions.o
  45. [thread 2][gcc -pthread] core/config.o
  46. [thread 5][gcc -pthread] core/setup_utils.o
  47. [thread 7][gcc -pthread] core/clock.o
  48. [thread 1][gcc -pthread] core/init.o
  49. [thread 3][gcc -pthread] core/buffer.o
  50. [thread 4][gcc -pthread] core/reader.o
  51. [thread 6][gcc -pthread] core/writer.o
  52. [thread 5][gcc -pthread] core/alarm.o
  53. [thread 0][gcc -pthread] core/cron.o
  54. [thread 2][gcc -pthread] core/hooks.o
  55. [thread 7][gcc -pthread] core/plugins.o
  56. [thread 1][gcc -pthread] core/lock.o
  57. [thread 3][gcc -pthread] core/cache.o
  58. [thread 6][gcc -pthread] core/daemons.o
  59. [thread 0][gcc -pthread] core/errors.o
  60. [thread 1][gcc -pthread] core/hash.o
  61. [thread 5][gcc -pthread] core/master_events.o
  62. [thread 4][gcc -pthread] core/chunked.o
  63. [thread 2][gcc -pthread] core/queue.o
  64. [thread 7][gcc -pthread] core/event.o
  65. [thread 1][gcc -pthread] core/signal.o
  66. [thread 6][gcc -pthread] core/strings.o
  67. [thread 4][gcc -pthread] core/progress.o
  68. [thread 0][gcc -pthread] core/timebomb.o
  69. [thread 5][gcc -pthread] core/ini.o
  70. [thread 2][gcc -pthread] core/fsmon.o
  71. [thread 4][gcc -pthread] core/mount.o
  72. [thread 1][gcc -pthread] core/metrics.o
  73. [thread 7][gcc -pthread] core/plugins_builder.o
  74. [thread 3][gcc -pthread] core/sharedarea.o
  75. [thread 0][gcc -pthread] core/rpc.o
  76. [thread 6][gcc -pthread] core/gateway.o
  77. [thread 4][gcc -pthread] core/loop.o
  78. [thread 5][gcc -pthread] core/cookie.o
  79. [thread 2][gcc -pthread] core/querystring.o
  80. [thread 7][gcc -pthread] core/rb_timers.o
  81. [thread 4][gcc -pthread] core/transformations.o
  82. [thread 3][gcc -pthread] core/uwsgi.o
  83. [thread 0][gcc -pthread] proto/base.o
  84. [thread 6][gcc -pthread] proto/uwsgi.o
  85. [thread 7][gcc -pthread] proto/http.o
  86. [thread 2][gcc -pthread] proto/fastcgi.o
  87. [thread 5][gcc -pthread] proto/scgi.o
  88. [thread 4][gcc -pthread] proto/puwsgi.o
  89. [thread 1][gcc -pthread] lib/linux_ns.o
  90. [thread 6][gcc -pthread] core/zlib.o
  91. [thread 4][gcc -pthread] core/regexp.o
  92. [thread 5][gcc -pthread] core/routing.o
  93. [thread 1][gcc -pthread] core/yaml.o
  94. [thread 0][gcc -pthread] core/ssl.o
  95. [thread 2][gcc -pthread] core/legion.o
  96. [thread 7][gcc -pthread] core/xmlconf.o
  97. [thread 4][gcc -pthread] core/dot_h.o
  98. [thread 4][gcc -pthread] core/config_py.o
  99. *** uWSGI compiling embedded plugins ***
  100. [thread 4][gcc -pthread] plugins/python/python_plugin.o
  101. [thread 1][gcc -pthread] plugins/python/pyutils.o
  102. [thread 6][gcc -pthread] plugins/python/pyloader.o
  103. [thread 7][gcc -pthread] plugins/python/wsgi_handlers.o
  104. In file included from plugins/python/pyutils.c:1:0:
  105. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
  106. #include <Python.h>
  107. ^
  108. compilation terminated.
  109. In file included from plugins/python/python_plugin.c:1:0:
  110. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
  111. #include <Python.h>
  112. ^
  113. compilation terminated.
  114. In file included from plugins/python/wsgi_handlers.c:1:0:
  115. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
  116. #include <Python.h>
  117. ^
  118. compilation terminated.
  119. In file included from plugins/python/pyloader.c:1:0:
  120. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
  121. #include <Python.h>
  122. ^
  123. compilation terminated.
  124. [thread 0][gcc -pthread] plugins/python/wsgi_headers.o
  125. In file included from plugins/python/wsgi_headers.c:1:0:
  126. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
  127. #include <Python.h>
  128. ^
  129. compilation terminated.
  130. ----------------------------------------
  131. ERROR: Failed building wheel for uwsgi
  132. Running setup.py clean for uwsgi
  133. Failed to build uwsgi
  134. Installing collected packages: uwsgi
  135. Running setup.py install for uwsgi ... error
  136. 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:
  137. ERROR: /usr/lib64/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'descriptions'
  138. warnings.warn(msg)
  139. running install
  140. using profile: buildconf/default.ini
  141. detected include path: ['/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include', '/usr/local/include', '/usr/include']
  142. Patching "bin_name" to properly install_scripts dir
  143. detected CPU cores: 8
  144. 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);"
  145. core/utils.o is up to date
  146. core/protocol.o is up to date
  147. core/socket.o is up to date
  148. core/logging.o is up to date
  149. *** uWSGI compiling server core ***
  150. core/master.o is up to date
  151. core/master_utils.o is up to date
  152. core/emperor.o is up to date
  153. core/notify.o is up to date
  154. core/mule.o is up to date
  155. core/subscription.o is up to date
  156. core/stats.o is up to date
  157. core/sendfile.o is up to date
  158. core/async.o is up to date
  159. core/master_checks.o is up to date
  160. core/fifo.o is up to date
  161. core/offload.o is up to date
  162. core/io.o is up to date
  163. core/static.o is up to date
  164. core/websockets.o is up to date
  165. core/spooler.o is up to date
  166. core/snmp.o is up to date
  167. core/exceptions.o is up to date
  168. core/config.o is up to date
  169. core/setup_utils.o is up to date
  170. core/clock.o is up to date
  171. core/init.o is up to date
  172. core/buffer.o is up to date
  173. core/reader.o is up to date
  174. core/writer.o is up to date
  175. core/alarm.o is up to date
  176. core/cron.o is up to date
  177. core/hooks.o is up to date
  178. core/plugins.o is up to date
  179. core/lock.o is up to date
  180. core/cache.o is up to date
  181. core/daemons.o is up to date
  182. core/errors.o is up to date
  183. core/hash.o is up to date
  184. core/master_events.o is up to date
  185. core/chunked.o is up to date
  186. core/queue.o is up to date
  187. core/event.o is up to date
  188. core/signal.o is up to date
  189. core/strings.o is up to date
  190. core/progress.o is up to date
  191. core/timebomb.o is up to date
  192. core/ini.o is up to date
  193. core/fsmon.o is up to date
  194. core/mount.o is up to date
  195. core/metrics.o is up to date
  196. core/plugins_builder.o is up to date
  197. core/sharedarea.o is up to date
  198. core/rpc.o is up to date
  199. core/gateway.o is up to date
  200. core/loop.o is up to date
  201. core/cookie.o is up to date
  202. core/querystring.o is up to date
  203. core/rb_timers.o is up to date
  204. core/transformations.o is up to date
  205. core/uwsgi.o is up to date
  206. proto/base.o is up to date
  207. proto/uwsgi.o is up to date
  208. proto/http.o is up to date
  209. proto/fastcgi.o is up to date
  210. proto/scgi.o is up to date
  211. proto/puwsgi.o is up to date
  212. lib/linux_ns.o is up to date
  213. core/zlib.o is up to date
  214. core/regexp.o is up to date
  215. core/routing.o is up to date
  216. core/yaml.o is up to date
  217. core/ssl.o is up to date
  218. core/legion.o is up to date
  219. core/xmlconf.o is up to date
  220. [thread 3][gcc -pthread] core/dot_h.o
  221. [thread 1][gcc -pthread] core/config_py.o
  222. *** uWSGI compiling embedded plugins ***
  223. [thread 2][gcc -pthread] plugins/python/python_plugin.o
  224. [thread 0][gcc -pthread] plugins/python/pyutils.o
  225. [thread 4][gcc -pthread] plugins/python/pyloader.o
  226. [thread 6][gcc -pthread] plugins/python/wsgi_handlers.o
  227. [thread 5][gcc -pthread] plugins/python/wsgi_headers.o
  228. [thread 7][gcc -pthread] plugins/python/wsgi_subhandler.o
  229. [thread 1][gcc -pthread] plugins/python/web3_subhandler.o
  230. [thread 3][gcc -pthread] plugins/python/pump_subhandler.o
  231. In file included from plugins/python/pyutils.c:1:0:
  232. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
  233. #include <Python.h>
  234. ^
  235. compilation terminated.
  236. In file included from plugins/python/wsgi_headers.c:1:0:
  237. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
  238. #include <Python.h>
  239. ^
  240. compilation terminated.
  241. In file included from plugins/python/wsgi_subhandler.c:1:0:
  242. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
  243. #include <Python.h>
  244. ^
  245. compilation terminated.
  246. In file included from plugins/python/web3_subhandler.c:1:0:
  247. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
  248. #include <Python.h>
  249. ^
  250. compilation terminated.
  251. In file included from plugins/python/python_plugin.c:1:0:
  252. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
  253. #include <Python.h>
  254. ^
  255. compilation terminated.
  256. In file included from plugins/python/pyloader.c:1:0:
  257. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
  258. #include <Python.h>
  259. ^
  260. compilation terminated.
  261. In file included from plugins/python/wsgi_handlers.c:1:0:
  262. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
  263. #include <Python.h>
  264. ^
  265. compilation terminated.
  266. In file included from plugins/python/pump_subhandler.c:1:0:
  267. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
  268. #include <Python.h>
  269. ^
  270. compilation terminated.
  271. ----------------------------------------
  272. 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

参考:

  1. # yum install nginx python2-pip python-devel gcc openssl-devel libyaml-devel libffi-devel \   readline-devel zlib-devel gdbm-devel ncurses-devel gcc-c++ automake autoconf mysql-devel 
  2. 参考链接http://blog.51yip.com/server/2141.html

使用原生wsgiref测试正常

  1. git拉取代码或拷贝上传到项目目录
  2. git clone https://github.com/zenthought/wemonitor.git
  3. 启动测试:
  4. python3 manage.py runserver 0.0.0.0:8081
  5. 访问正常

 

使用supervisor管理进程

 

pip修改参考:

https://blog.csdn.net/lyll616/article/details/85090132

部署参考:https://blog.csdn.net/sinat_41898105/article/details/80897448

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/201179
推荐阅读
相关标签
  

闽ICP备14008679号