问题
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'"
回答1:
uWSGI needs a c compiler to build and the os.uname to use platform.uname needs to be updated in the uwsgiconfig.py file.
Here is how to fix for windows 10:
cd to uwsgi install directory and open uwsgiconfig.py
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]
to this:
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]
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.
- 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
This command should install the following packages for Cygwin64: gcc-core gcc-g++ libcrypt-devel libintl-devel python3 python3-devel
- In Cygwin terminal window
- cd to uwsgi directory
- type and run command 'python3 setup.py install'
- wait for this to finish and do a happy dance.
来源:https://stackoverflow.com/questions/54200746/cant-install-uwsgi-on-cygwin