Can't install uwsgi on cygwin

谁都会走 提交于 2020-01-25 12:47:58

问题


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:

  1. cd to uwsgi install directory and open uwsgiconfig.py

  2. 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]
  1. 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

      1. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!