pip3安装uwsgi出现问题

python版本为3.6
系统ubuntu16.04
安装出现问题

具体问题
ERROR: Command errored out with exit status 1:
   command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vv1gt6oq/uwsgi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vv1gt6oq/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-44zvag2l
       cwd: /tmp/pip-install-vv1gt6oq/uwsgi/
  Complete output (99 lines):
  /usr/lib/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-linux-gnu/5/include', '/usr/local/include', '/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed', '/usr/include/x86_64-linux-gnu', '/usr/include']
  Patching "bin_name" to properly install_scripts dir
  detected CPU cores: 4
  configured CFLAGS: -O2 -I. -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -DUWSGI_HAS_IFADDRS -DUWSGI_ZLIB -DUWSGI_LOCK_USE_MUTEX -DUWSGI_EVENT_USE_EPOLL -DUWSGI_EVENT_TIMER_USE_TIMERFD -DUWSGI_EVENT_FILEMONITOR_USE_INOTIFY -I/usr/local/include -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_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][x86_64-linux-gnu-gcc -pthread] core/utils.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/protocol.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] core/socket.o
  [thread 0][x86_64-linux-gnu-gcc -pthread] core/logging.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/master.o
  [thread 0][x86_64-linux-gnu-gcc -pthread] core/master_utils.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] core/emperor.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/notify.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/mule.o
  [thread 0][x86_64-linux-gnu-gcc -pthread] core/subscription.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/stats.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/sendfile.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] core/async.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/master_checks.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/fifo.o
  [thread 0][x86_64-linux-gnu-gcc -pthread] core/offload.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/io.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] core/static.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/websockets.o
  [thread 0][x86_64-linux-gnu-gcc -pthread] core/spooler.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/snmp.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] core/exceptions.o
  [thread 0][x86_64-linux-gnu-gcc -pthread] core/config.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/setup_utils.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] core/clock.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/init.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/buffer.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] core/reader.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/writer.o
  [thread 0][x86_64-linux-gnu-gcc -pthread] core/alarm.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/cron.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] core/hooks.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/plugins.o
  [thread 0][x86_64-linux-gnu-gcc -pthread] core/lock.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/cache.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] core/daemons.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/errors.o
  [thread 0][x86_64-linux-gnu-gcc -pthread] core/hash.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/master_events.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] core/chunked.o
  [thread 0][x86_64-linux-gnu-gcc -pthread] core/queue.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/event.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] core/signal.o
  [thread 0][x86_64-linux-gnu-gcc -pthread] core/strings.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/progress.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] core/timebomb.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/ini.o
  [thread 0][x86_64-linux-gnu-gcc -pthread] core/fsmon.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/mount.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] core/metrics.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/plugins_builder.o
  [thread 0][x86_64-linux-gnu-gcc -pthread] core/sharedarea.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/rpc.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/gateway.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/loop.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/cookie.o
  [thread 0][x86_64-linux-gnu-gcc -pthread] core/querystring.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/rb_timers.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/transformations.o
  [thread 0][x86_64-linux-gnu-gcc -pthread] core/uwsgi.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] proto/base.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] proto/uwsgi.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] proto/http.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] proto/fastcgi.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] proto/scgi.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] proto/puwsgi.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] lib/linux_ns.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/zlib.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/regexp.o
  [thread 1][x86_64-linux-gnu-gcc -pthread] core/routing.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/yaml.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] core/xmlconf.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/dot_h.o
  [thread 3][x86_64-linux-gnu-gcc -pthread] core/config_py.o
  *** uWSGI compiling embedded plugins ***
  [thread 3][x86_64-linux-gnu-gcc -pthread] plugins/python/python_plugin.o
  [thread 2][x86_64-linux-gnu-gcc -pthread] plugins/python/pyutils.o
  In file included from plugins/python/python_plugin.c:1:0:
  plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: 没有那个文件或目录
  compilation terminated.
  In file included from plugins/python/pyutils.c:1:0:
  plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: 没有那个文件或目录
  compilation terminated.
  ----------------------------------------
  ERROR: Failed building wheel for uwsgi

解决方案:
重点在这而:

 plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: 没有那个文件或目录
  compilation terminated.

提示Python.h: 没有那个文件或目录
环境不完整
执行命令 sudo apt-get install python3.6-dev(我是python3.6,如果直接写3默认好象是3.5)。

安装uwsgi,可以按照以下步骤进行操作: 1. 首先,在项目中创建一个包含项目依赖的requirements.txt文件。你可以使用以下两种方法来生成该文件: - 执行命令 `pip freeze > requirements.txt`,这会将所有环境的依赖包都导出到requirements.txt文件中。 - 安装pipreqs,并执行命令 `pipreqs ./ --encoding=utf-8`,这会仅仅导出项目所依赖的包。 2. 修改代码,将项目传到Linux服务器上。确保已经调整好了代码,例如将app的创建改为 `app = create_app('product')`。 3. 在Linux服务器上启动uwsgi服务。可以通过以下命令进行启动: - `uwsgi --ini uwsgi.ini`,这会直接进入控制台启动uwsgi服务器。 - `nohup uwsgi --ini uwsgi.ini &`,这会在后台启动uwsgi服务器。 4. 如果需要重启uwsgi服务,可以使用以下命令: - `uwsgi --reload uwsgi.pid`,这会重新加载uwsgi服务。 5. 如果需要停止uwsgi服务,可以使用以下命令: - `uwsgi --stop uwsgi.pid`,这会停止uwsgi服务。 请注意,如果需要直接关闭uwsgi服务,可以使用 `kill -9 pid` 命令,其中pid是uwsgi的进程ID。 对于在CentOS上安装uwsgi,可以按照以下步骤进行操作: 1. 首先,安装所需的依赖库。可以使用以下命令来安装: ``` yum groupinstall "Development tools" yum install zlib-devel bzip2-devel pcre-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel python-devel ``` 2. 使用pip安装uwsgi: ``` pip install uwsgi ``` 如果你没有使用虚拟环境,你可能需要手动将uwsgi的路径添加到sys.path中。例如: ``` import sys sys.path.append('/usr/lib/python2.7/site-packages') sys.path.append('/usr/lib64/python2.7/site-packages') ``` 这样就可以使用pip安装uwsgi了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [关于uWSGI服务器的安装和启动(一)](https://blog.csdn.net/YZL40514131/article/details/123462528)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [pip 安装uwsgi](https://blog.csdn.net/weixin_34414650/article/details/92462413)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值