mac安装uwsgi报错Exception: you need a C compiler to build uWSGI 解决方法

MacBook 安装 uwsgi 报错 Exception: you need a C compiler to build uWSGI 解决方法

$:pip install uwsgi
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/5m/qj65yhvx5hv01b0d_4vxw5mr0000gn/T/pip-install-hnhcssov/uwsgi_e05708a44ea748a9a2579108da2ccf32/setup.py", line 117, in <module>
        setup(
      File "/Users/aley/.virtualenvs/cupd/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/private/var/folders/5m/qj65yhvx5hv01b0d_4vxw5mr0000gn/T/pip-install-hnhcssov/uwsgi_e05708a44ea748a9a2579108da2ccf32/setup.py", line 77, in run
        conf = uc.uConf(get_profile())
      File "/private/var/folders/5m/qj65yhvx5hv01b0d_4vxw5mr0000gn/T/pip-install-hnhcssov/uwsgi_e05708a44ea748a9a2579108da2ccf32/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
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/aley/.virtualenvs/cupd/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5m/qj65yhvx5hv01b0d_4vxw5mr0000gn/T/pip-install-hnhcssov/uwsgi_e05708a44ea748a9a2579108da2ccf32/setup.py'"'"'; __file__='"'"'/private/var/folders/5m/qj65yhvx5hv01b0d_4vxw5mr0000gn/T/pip-install-hnhcssov/uwsgi_e05708a44ea748a9a2579108da2ccf32/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/5m/qj65yhvx5hv01b0d_4vxw5mr0000gn/T/pip-record-mlq0npic/install-record.txt --single-version-externally-managed --compile --install-headers /Users/aley/.virtualenvs/cupd/include/site/python3.9/uwsgi Check the logs for full command output.

解决方法

$:xcode-select --install  

输入上面命令之后等待安装完毕。然后重新安装uwsgi就可以了。

posted @ 2021-03-16 16:27  Python-永远滴神  阅读(165)  评论(0编辑  收藏  举报