无法在Cygwin上安装uwsgi [英] Can't install uwsgi on cygwin
问题描述
我的主要操作系统是Windows 10,但我使用cygwin作为终端.通过 pip3 install uwsgi
命令安装uwsgi时,它失败,并显示错误消息"AttributeError:模块'os'没有属性'uname'"
My main OS is windows 10 but I am using cygwin as a terminal. While installing uwsgi through pip3 install uwsgi
command , it fails with an error message " AttributeError: module 'os' has no attribute 'uname'"
推荐答案
uWSGI需要使用c编译器来构建,并且要使用platform.uname的os.uname需要在uwsgiconfig.py文件中进行更新.
uWSGI needs a c compiler to build and the os.uname to use platform.uname needs to be updated in the uwsgiconfig.py file.
以下是针对Windows 10的修复方法:
Here is how to fix for windows 10:
-
cd到uwsgi安装目录并打开uwsgiconfig.py
cd to uwsgi install directory and open uwsgiconfig.py
用以下代码行将os.uname替换为platform.uname:
replace os.uname with platform.uname for the following lines of code:
uwsgi_os = os.uname ()[0]uwsgi_os_k = re.split('[-+ _]', os.uname ()[2])[0]uwsgi_os_v = os.uname ()[3]uwsgi_cpu = os.uname ()[4]
uwsgi_os = os.uname()[0] uwsgi_os_k = re.split('[-+_]', os.uname()[2])[0] uwsgi_os_v = os.uname()[3] uwsgi_cpu = os.uname()[4]
对此:
uwsgi_os = **platform.uname**()[0]
uwsgi_os_k = re.split('[-+_]', **platform.uname**()[2])[0]
uwsgi_os_v = **platform.uname**()[3]
uwsgi_cpu = **platform.uname**()[4]
-
使用cygwin安装以下软件包,以确保您具有适用于cygwin终端的python3和gcc,而不仅仅是Windows上安装的python.这是Windows之外的单独python安装.
Install the following packages with cygwin to make sure you have python3 and gcc available for cygwin terminal and not just python installed on windows. This is a separate python install than for windows itself.
- 打开Windows cmd终端
- 将CD转换为cygwin64(或您的安装目录)
-
运行以下命令:setup-x86_64.exe -q -P wget -P gcc-g ++ -P gcc-core -P gcc-g ++ -P libcrypt-devel -P libintl-devel -P python3 -P python3-devel
- Open windows cmd terminal
- cd to cygwin64 (or your install dir)
run this command: setup-x86_64.exe -q -P wget -P gcc-g++ -P gcc-core -P gcc-g++ -P libcrypt-devel -P libintl-devel -P python3 -P python3-devel
此命令应为Cygwin64安装以下软件包:gcc核心gcc-g ++libcrypt开发libintl-开发python3python3-devel
This command should install the following packages for Cygwin64: gcc-core gcc-g++ libcrypt-devel libintl-devel python3 python3-devel
- 在Cygwin终端窗口中
这篇关于无法在Cygwin上安装uwsgi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!