蓝色的天_90  

使用pip安装

pip install uwsgi

报错:AttributeError: module 'os' has no attribute 'uname'

 ERROR: Command errored out with exit status 1:
     command: 'c:\program files\python3.6\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\shuai\\AppData\\Local\\Temp\\pip-install-7ygjud00\\uwsgi\\setup.py'"'"'; __file__='"'"'C:\\Users\\shuai\\AppData\\Local\\Temp\\pip-install-7ygjud00\\uwsgi\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\shuai\AppData\Local\Temp\pip-install-7ygjud00\uwsgi\pip-egg-info'
         cwd: C:\Users\shuai\AppData\Local\Temp\pip-install-7ygjud00\uwsgi\
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\shuai\AppData\Local\Temp\pip-install-7ygjud00\uwsgi\setup.py", line 3, in <module>
        import uwsgiconfig as uc
      File "C:\Users\shuai\AppData\Local\Temp\pip-install-7ygjud00\uwsgi\uwsgiconfig.py", line 8, in <module>
        uwsgi_os = os.uname()[0]
    AttributeError: module 'os' has no attribute 'uname'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

报错说明:

是因为uwsgiconfig.py文件中,os.uname()是不支持windows系统的,platform模块是支持任何系统。

下载uwsgi离线安装

https://pypi.org/project/uWSGI/#files

解压后,进入目录下,修改uwsgiconfig.py文件中的os.uname()为platform.uname()

 

 

然后再cd进入目录执行:python setup.py install

报错:Exception: you need a C compiler to builduWSGI

C:\Program Files\Python3.6\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'descriptions'
  warnings.warn(msg)
running install
using profile: buildconf/default.ini
detected include path: ['/usr/include', '/usr/local/include']
Traceback (most recent call last):
  File "C:\Program Files\Python3.6\Scripts\uwsgi-2.0.18\uwsgiconfig.py", line 747, in __init__
    gcc_version_components = gcc_version.split('.')
AttributeError: 'NoneType' object has no attribute 'split'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 138, in <module>
    'Programming Language :: Python :: 3.6',
  File "C:\Program Files\Python3.6\lib\site-packages\setuptools\__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "C:\Program Files\Python3.6\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Program Files\Python3.6\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "C:\Program Files\Python3.6\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "setup.py", line 77, in run
    conf = uc.uConf(get_profile())
  File "C:\Program Files\Python3.6\Scripts\uwsgi-2.0.18\uwsgiconfig.py", line 755, in __init__
    raise Exception("you need a C compiler to build uWSGI")
Exception: you need a C compiler to build uWSGI

报错说明:需要安装C语言编译环境

如果本机上没有C编译环境,需要下载一个编译器

推荐下载:MinGW

下载地址:https://osdn.net/projects/mingw/downloads/68260/mingw-get-setup.exe/

 

 

 

 

 

安装好之后配置环境变量:path=MinGW安装目录/bin

3.再次安装
python setup.py install

原文链接:https://blog.csdn.net/lm3758/article/details/83345412

posted on 2020-04-24 20:01  蓝色的天_90  阅读(9205)  评论(0编辑  收藏  举报