繁体   English   中英

如何在windows上安装uwsgi?

[英]How to install uwsgi on windows?

我正在尝试在虚拟环境中为 django 项目安装 uwsgi; 我正在使用 windows 10。

我做了pip install uwsgi & 我得到了Command "python setup.py egg_info"

因此,为了解决错误,我遵循了这个SO answer

根据答案,我在之后为 windows 安装了 cygwin 和 gcc 编译器。

还将 os.uname()更改为platform.uname()

现在当我运行`python setup.py install`。 我收到此错误

C:\Users\Suhail\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\_distutils\dist.py:275: UserWarning: Unknown distribution option: 'descriptions'
  warnings.warn(msg)
running install
C:\Users\Suhail\AppData\Local\Programs\Python\Python39\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
using profile: buildconf/default.ini
detected include path: ['/usr/include', '/usr/local/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_IPCSEM_ATEXIT -DUWSGI_EVENT_TIMER_USE_NONE -DUWSGI_EVENT_FILEMONITOR_USE_NONE -DUWSGI_VERSION="\"2.0.19.1\"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="0" -DUWSGI_VERSION_MINOR="19" -DUWSGI_VERSION_REVISION="1" -DUWSGI_VERSION_CUSTOM="\"\"" -DUWSGI_YAML -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(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(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 1][gcc] core/utils.o
[thread 2][gcc] core/protocol.o
[thread 3][gcc] core/socket.o
[thread 0][gcc] core/logging.o
In file included from In file included from core/logging.c:2core/socket.c:1                      :
:
                                  ./uwsgi.h:172:10::
                                fatal error:  sys/socket.h: No such file or directory
 #include sys/socket.h: No such file or directory
 #include                            <sys/socket.h>sys/socket.h: No such file or directory
 #include

                        ^~~~~~~~~~~~~~^~~~~~~~~~~~~~


cc^~~~~~~~~~~~~~o mm
ppiillaattiioonn  cttoeemrrpmmiiilnnaaatttieeoddn..

In file included from t rcore/utils.c:1mi:
n
 uwsgi-2.0.19.1> t./uwsgi.h:172:10:ed .
fatal error: sys/socket.h: No such file or directory
 #include <sys/socket.h>
          ^~~~~~~~~~~~~~
compilation terminated.

第 1 步下载此稳定版本的 uWSGI

第 2 步:解压缩虚拟环境的site-packages文件夹中的tar文件。

例如,提取的 uwsgi 路径应该是:

\my_env\lib\site-packages\uwsgi-2.0.19.1

第 3 步:打开uwsgi-2.0.19.1\uwsgiconfig.py并进行以下编辑:

import platform
...

那么无论你遇到什么

...
os.uname()[x-index]
...

修改它

...
platform.uname()[x-index]
...

第 4 步:最后,打开 powershell 并 cd 进入\my_env\lib\site-packages\uwsgi-2.0.19.1并运行:

python setup.py

有错误吗? 看看这个

第 5 步:运行pip install uwsgi你会得到已经满足的要求: . 尝试 pip freeze 你会看到 uwsgi 被列出。 这意味着您现在已经成功安装了 uwsgi。 恭喜


参考

在 windows 上安装 UWSGI 这里有完整的解释

https://youtu.be/S3wm4Ytho4Q

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM