• pip install uwsgi 报错 AttributeError: module 'os' has no attribute 'uname'


    使用pip安装

    pip install uwsgi

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

     ERROR: Command errored out with exit status 1:
         command: 'c:program filespython3.6python.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('"'"'
    '"'"', '"'"'
    '"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:UsersshuaiAppDataLocalTemppip-install-7ygjud00uwsgipip-egg-info'
             cwd: C:UsersshuaiAppDataLocalTemppip-install-7ygjud00uwsgi
        Complete output (7 lines):
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "C:UsersshuaiAppDataLocalTemppip-install-7ygjud00uwsgisetup.py", line 3, in <module>
            import uwsgiconfig as uc
          File "C:UsersshuaiAppDataLocalTemppip-install-7ygjud00uwsgiuwsgiconfig.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 FilesPython3.6libdistutilsdist.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 FilesPython3.6Scriptsuwsgi-2.0.18uwsgiconfig.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 FilesPython3.6libsite-packagessetuptools\__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "C:Program FilesPython3.6libdistutilscore.py", line 148, in setup
        dist.run_commands()
      File "C:Program FilesPython3.6libdistutilsdist.py", line 955, in run_commands
        self.run_command(cmd)
      File "C:Program FilesPython3.6libdistutilsdist.py", line 974, in run_command
        cmd_obj.run()
      File "setup.py", line 77, in run
        conf = uc.uConf(get_profile())
      File "C:Program FilesPython3.6Scriptsuwsgi-2.0.18uwsgiconfig.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

  • 相关阅读:
    Java
    Java
    SpringBoot
    面对 DDoS 攻击,我们能做些什么?
    instanceof运算符的实质:Java继承链与JavaScript原型链
    从λ演算到函数式编程聊闭包(1):闭包概念在Java/PHP/JS中形式
    JIT-动态编译与AOT-静态编译:java/ java/ JavaScript/Dart乱谈
    JS遍历循环方法性能对比:for/while/for in/for of/map/foreach/every
    线程池的使用示例-批量查询
    国企离职鸡飞狗跳记
  • 原文地址:https://www.cnblogs.com/ningy1009/p/12769776.html
Copyright © 2020-2023  润新知