Python 为uwsgi构建轮子失败

Python 为uwsgi构建轮子失败,python,ubuntu,uwsgi,Python,Ubuntu,Uwsgi,我遇到一个错误,为uwsgi构建轮子失败。 我的环境 是Ubuntu,现在我想安装uwsgi,所以我运行命令pip install uwsgi。但是错误发生了 回溯(最近一次呼叫最后一次): 文件“”,第1行,在 文件“/tmp/pip-build-9t06jm4_u/uwsgi/setup.py”,第126行,在 distclass=UwsgidDistribution, 文件“/home/ubuntu/anaconda3/lib/python3.5/distutils/core.py”,第

我遇到一个错误,为uwsgi构建轮子失败。 我的环境 是Ubuntu,现在我想安装uwsgi,所以我运行命令
pip install uwsgi
。但是错误发生了

回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/tmp/pip-build-9t06jm4_u/uwsgi/setup.py”,第126行,在
distclass=UwsgidDistribution,
文件“/home/ubuntu/anaconda3/lib/python3.5/distutils/core.py”,第148行,在安装程序中
dist.run_命令()
文件“/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py”,第955行,在run_命令中
self.run_命令(cmd)
文件“/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py”,第974行,在run_命令中
cmd_obj.run()
文件“/home/ubuntu/anaconda3/lib/python3.5/site packages/wheel/bdist_wheel.py”,第215行,运行中
self.run_命令('install')
文件“/home/ubuntu/anaconda3/lib/python3.5/distutils/cmd.py”,第313行,在run_命令中
self.distribution.run_命令(command)
文件“/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py”,第974行,在run_命令中
cmd_obj.run()
文件“/tmp/pip-build-9t06jm4_u/uwsgi/setup.py”,第77行,运行中
conf=uc.uConf(get_profile())
文件“/tmp/pip-build-9t06jm4_uu/uwsgi/uwsgiconfig.py”,第742行,在__
引发异常(“您需要一个C编译器来构建uWSGI”)
例外:您需要一个C编译器来构建uWSGI
----------------------------------------
为uwsgi构建轮子失败
为uwsgi运行setup.py clean
未能生成uwsgi
安装收集的软件包:uwsgi
正在为uwsgi运行setup.py安装。。。错误
从command/home/ubuntu/anaconda3/bin/python-u-c“导入setuptools,tokenize;uuu-file uu=”/tmp/pip-build-9t06jm4/uusgi/setup.py';f=getattr(tokenize,'open',open)(uuu-file,'code=f.read().replace('\r\n','n');f.close();exec(编译(代码,'uu-file,'exec'))”install--record/tmp/pip-oxbyg6gk-record/install-record.txt--外部管理的单一版本--编译:
/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py:261:UserWarning:未知的分发选项:“descriptions”
警告。警告(msg)
正在运行的安装
使用概要文件:buildconf/default.ini
检测到包含路径:['/usr/include','/usr/local/include']
回溯(最近一次呼叫最后一次):
文件“/tmp/pip-build-9t06jm4_uu/uwsgi/uwsgiconfig.py”,第734行,在__
gcc_version_components=gcc_version.split('.'))
AttributeError:“非类型”对象没有属性“拆分”
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/tmp/pip-build-9t06jm4_u/uwsgi/setup.py”,第126行,在
distclass=UwsgidDistribution,
文件“/home/ubuntu/anaconda3/lib/python3.5/distutils/core.py”,第148行,在安装程序中
dist.run_命令()
文件“/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py”,第955行,在run_命令中
self.run_命令(cmd)
文件“/home/ubuntu/anaconda3/lib/python3.5/distutils/dist.py”,第974行,在run_命令中
cmd_obj.run()
文件“/tmp/pip-build-9t06jm4_u/uwsgi/setup.py”,第77行,运行中
conf=uc.uConf(get_profile())
文件“/tmp/pip-build-9t06jm4_uu/uwsgi/uwsgiconfig.py”,第742行,在__
引发异常(“您需要一个C编译器来构建uWSGI”)
例外:您需要一个C编译器来构建uWSGI
----------------------------------------

命令“/home/ubuntu/anaconda3/bin/python-u-c”导入setuptools,标记化__文件_uui='/tmp/pip-build-9t06jm4_uu/uwsgi/setup.py';f=getattr(标记化“打开”,打开)(_文件);code=f.read().replace('\r\n','\n');f、 close();exec(compile(code,_ufile,_u,'exec'))“安装--record/tmp/pip-oxbyg6gk-record/install-record.txt--外部管理的单一版本--compile”失败,错误代码为/tmp/pip-build-9t06jm4/uwsgi/
您的异常明确指出了错误:

gcc_version_components = gcc_version.split('.')
AttributeError: 'NoneType' object has no attribute 'split'

因此,一般来说,您的系统没有安装c编译器(例如gcc)。尝试安装它。在Ubuntu中是
sudo-apt-get-install-gcc


顺便说一句,我认为这个问题更适合这个页面。

大多数linux软件包管理器提供大多数预编译的东西。例如在Ubuntu上:

sudo apt install uwsgi-plugin-python3

这将使
uwsgi
在全球范围内可用,而不仅仅是在一个virtualenv中,并且是安装C编译器的替代方案。

这是因为服务器上没有C编译器。如果您使用的是AWS或Digital Ocean之类的云端实例,则通常不会安装gcc。所以你需要手动安装它

sudo apt update
sudo apt install gcc 
sudo pip install uwsgi # Sudo as the server requires root access
我们应该解决这个问题

sudo apt update
sudo apt install gcc 
sudo pip install uwsgi # Sudo as the server requires root access