背景

本来是想着在centos 7.9的主机上面部署一个flask应用,采用的方式是linux+nginx+uwsgi来进行发布,其他的都没有问题,但是在使用pip安装uwsgi时报错了,安装不成功,查了很多方法:试过把pip更新、安装python3-devel等等,但都是不行,最后还是得靠自己,研究了下pip安装方式,发现安装uwsgi是编译安装的,最后一查询发现gcc-c++没有装,安装之后再去安装uwsgi发现就成功。

问题描述

下面是我安装的时候的报错:

[root@* ~]# sudo pip3 install uwsgi

WARNING: Running pip install with root privileges is generally not a good idea. Try pip3 install --user instead.

Collecting uwsgi

Using cached https://files.pythonhosted.org/packages/b3/8e/b4fb9f793745afd6afcc0d2443d5626132e5d3540de98f28a8b8f5c753f9/uwsgi-2.0.21.tar.gz

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-8796okps/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-2_lro4bs-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-8796okps/uwsgi/uwsgiconfig.py", line 750, 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-8796okps/uwsgi/setup.py", line 143, in <module>
'Programming Language :: Python :: 3.11',
File "/usr/lib/python3.6/site-packages/setuptools/__init__.py", line 129, 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-8796okps/uwsgi/setup.py", line 77, in run
conf = uc.uConf(get_profile())
File "/tmp/pip-build-8796okps/uwsgi/uwsgiconfig.py", line 758, 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-8796okps/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-2_lro4bs-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-8796okps/uwsgi/

解决方案

[root@* ~]# yum -y install python3-devel

[root@* ~]# yum -y installl gcc-c++

安装好之后再pip安装uwsgi就没问题了。

记一次pip/pip3安装uwsgi报错的更多相关文章

  1. 安装 uwsgi报错解决

    背景: 安装 uwsgi时报错如下,查阅相关资料说是 python-devel的问题,于是安装之后python-devel后问题解决 报错如下: (venv) [xxxxxxx]# pip insta ...

  2. Ubuntu16.04上使用Anaconda3的Python3.6的pip安装UWSGI报错解决办法

    具体报错信息: lto1: fatal error: bytecode stream generated with LTO version 6.0 instead of the expected 4. ...

  3. linux安装uwsgi,报错问题解决

    uwsgi安装 uwsgi启动后出 -- unavailable modifier requested: 0 出现问题的的原因是找不到python的解释器(其他语言同理) 你使用的yum instal ...

  4. Centos pip 安装uwsgi 报错“fatal error: Python.h: No such file or directory”

    解决方法: 安装python-devel即可,注意,不是python-dev yum -y install python-devel

  5. centos7安装uwsgi报错

    错误为: [root@bogon ~]# pip install uwsgi Collecting uwsgi Using cached uwsgi-.tar.gz Installing collec ...

  6. Deepin下python安装uwsgi报错: Python.h:没有那个文件或目录

    解决方法是安装python-dev,这是Python的头文件和静态库包 正在读取软件包列表... 完成正在分析软件包的依赖关系树       正在读取状态信息... 完成       下列软件包是自动 ...

  7. mac下安装mysqlcient 报错

    一.我在mac下pip3安装mysqlclient 报错: pip3 install mysqlclient Collecting mysqlclient Using cached mysqlclie ...

  8. 记一次用pip安装docker-compose报错及解决方法

    Docker-Compose 的安装 方法一 # 下载1.25.0 docker compose sudo curl -L "https://github.com/docker/compos ...

  9. python︱模块加载(pip安装)以及pycharm安装与报错解决方式

    每每以为攀得众山小,可.每每又切实来到起点,大牛们,缓缓脚步来俺笔记葩分享一下吧,please~ --------------------------- 准备放下R开始学python,真是痛苦,因为找 ...

  10. pip安装pycrypto报错:Microsoft Visual C++ 14.0 is required. 和 SSLError: HTTPSConnectionPool的解决办法

    今天本打算把[Python3爬虫]网易云音乐爬虫 的代码敲一遍, 但是在安装pycrypto老是报错, 由于我计算是win10, 并且也有vs2017 python3环境下安装pycrypto的一些问 ...

随机推荐

  1. python语言绘图:绘制一组二项分布图

    代码源自: https://github.com/PacktPublishing/Bayesian-Analysis-with-Python ============================= ...

  2. Auto.js 入门教程(二)

    来了来了 ~ 下面开始学习auto.js 了! 准备材料 : android7.0及以上版本的手机一部(需要开启 '无障碍服务') auto.js软件 vscode (安装配套插件Auto.js-VS ...

  3. 11-canvas绘制折线图

    1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="U ...

  4. 代码随想录Day15

    110.平衡二叉树 (优先掌握递归) 给定一个二叉树,判断它是否是 平衡二叉树 平衡二叉树 是指该树所有节点的左右子树的深度相差不超过 1. 示例 1: 输入:root = [3,9,20,null, ...

  5. C#ListView类的继承

    ListView控件类新加方法 新建一个类myListView class myListView : System.Windows.Forms.ListView { //添加自定义的方法 -- //设 ...

  6. 在NextChat中接入SiliconCloud API 体验不同的开源先进大语言模型

    NextChat介绍 One-Click to get a well-designed cross-platform ChatGPT web UI, with GPT3, GPT4 & Gem ...

  7. Https通信的SSL证书工作流程原理(转)

    前言 浏览器与服务器之间的https加密通信会包括以下一些概念:非对称加密.对称加密.RSA.证书申请.根证书.https证书加密,就是在传输层tcp和应用层http之间加了一层ssl层来对传输内容进 ...

  8. IDEA 2023.2 最新安装使用教程(附激活码,亲测好用)

    申明:本教程 IDEA 补丁.补丁均收集于网络,请勿商用,仅供个人学习使用,如有侵权,请联系作者删除.若条件允许,希望大家购买正版 ! idea激活码使用教程 Step1 第一步下载IDEA软件 ID ...

  9. vue 报错 Component template should contain exactly one root element. If you are using v-if on multiple elements

    vue 报错 Component template should contain exactly one root element. If you are using v-if on multiple ...

  10. 掌握 C++17:结构化绑定与拷贝消除的妙用

    C++17 特性示例 1. 结构化绑定(Structured Binding) 结构化绑定允许你用一个对象的元素或成员同时实例化多个实体. 结构化绑定允许你在声明变量的同时解构一个复合类型的数据结构( ...