Linux安裝uWSGI失敗處理辦法Exception: you need a C compiler to build uWSGI
[root@djc_nb djc_wcapp]# pip3 install uwsgi WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead. Collecting uwsgi Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/e7/1e/3dcca007f974fe4eb369bf1b8629d5e342bb3055e2001b2e5340aaefae7a/uwsgi-2.0.18.tar.gz (801kB) 100% |████████████████████████████████| 808kB 34.6MB/s Installing collected packages: uwsgi Running setup.py install for uwsgi ... error Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-my0oievx/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-v3lfzw8y-record/install-record.txt --single-version-externally-managed --compile: /usr/lib64/python3.6/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 "/tmp/pip-build-my0oievx/uwsgi/uwsgiconfig.py", line 742, 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 "<string>", line 1, in <module> File "/tmp/pip-build-my0oievx/uwsgi/setup.py", line 138, in <module> 'Programming Language :: Python :: 3.6', File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup return distutils.core.setup(**attrs) File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands self.run_command(cmd) File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/tmp/pip-build-my0oievx/uwsgi/setup.py", line 77, in run conf = uc.uConf(get_profile()) File "/tmp/pip-build-my0oievx/uwsgi/uwsgiconfig.py", line 750, in __init__ raise Exception("you need a C compiler to build uWSGI") Exception: you need a C compiler to build uWSGI ---------------------------------------- Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-my0oievx/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-v3lfzw8y-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-my0oievx/uwsgi/
解決方案
yum install gcc
也有的用這種方法 但是我的機器不管用
先查看python版本 再安裝對應版本的 python devel [root@djc_nb djc_wcapp]# yum install python36-devel