如何在 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 编译器,如下所示
this.
还将os.uname()更改为platform.uname()
现在当我 运行 `python setup.py 安装时``。我得到这个错误
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 步:Download uWSGI 的稳定版本
第二步:解压虚拟环境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
遇到错误? Check out this
第 5 步:运行 pip install uwsgi
你会得到要求已经满足:。尝试 pip freeze 你会看到 uwsgi 已列出。这意味着您现在已经成功安装了 uwsgi。恭喜!
Reference
我正在尝试为虚拟环境中的 django 项目安装 uwsgi;我正在使用 windows 10.
我做了 pip install uwsgi
& 我得到了Command "python setup.py egg_info"
。
因此,为了解决错误,我遵循了这个 SO answer
根据回答,我为 windows 安装了 cygwin 和 gcc 编译器,如下所示 this.
还将os.uname()更改为platform.uname()
现在当我 运行 `python setup.py 安装时``。我得到这个错误
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 步:Download uWSGI 的稳定版本
第二步:解压虚拟环境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
遇到错误? Check out this
第 5 步:运行 pip install uwsgi
你会得到要求已经满足:。尝试 pip freeze 你会看到 uwsgi 已列出。这意味着您现在已经成功安装了 uwsgi。恭喜!
Reference