【uWSGI】ERROR: Could not build wheels for uwsgi, which is required to install pyproject.toml-based...

文章讲述了在Python3.9的Anaconda环境中安装uWSGI遇到的编译错误,介绍了使用conda进行安装的几种可行方法,包括不同标签的conda-forge版本。作者分享了解决过程中的尝试和最终选择的简便方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、问题描述

在 Python3.9 的 Anaconda 虚拟环境中安装 uWSGI 时出现以下报错:

	gcc: error: /home/mzx/anaconda3/envs/mysites/lib/python3.9/config-3.9-x86_64-linux-gnu/libpython3.9.a: 没有那个文件或目录
    	*** error linking uWSGI ***
    	[end of output]
  
 	note: This error originates from a subprocess, and is likely not a problem with pip.
 	ERROR: Failed building wheel for uwsgi
 	Running setup.py clean for uwsgi
Failed to build uwsgi
ERROR: Could not build wheels for uwsgi, which is required to install pyproject.toml-based projects

二、解决方法

使用 conda 安装即可,语句如下:

conda install -c conda-forge uwsgi

或者 使用下述语句(任选其一即可):

conda install -c "conda-forge/label/broken" uwsgi
conda install -c "conda-forge/label/cf201901" uwsgi
conda install -c "conda-forge/label/cf202003" uwsgi
conda install -c "conda-forge/label/gcc7" uwsgi

指令来源于 Anaconda 官网:https://anaconda.org/conda-forge/uwsgi
在这里插入图片描述

三、成功安装

使用上述命令后可以很轻松地成功安装:
在这里插入图片描述

四、解决历程

本部分仅记录一下本人走过的弯路,与解决方案无关。

在这里插入图片描述

  1. 在出现报错之后,首先试图安装编译依赖关系:sudo apt-get install build-essential python-dev
    【无功而返】
  2. 换为pyhton3sudo apt-get install build-essential python3-dev
    【无功而返】
  3. 尝试本地安装
    • 下载: wget https://files.pythonhosted.org/packages/a7/4e/c4d5559b3504bb65175a759392b03cac04b8771e9a9b14811adf1151f02f/uwsgi-2.0.22.tar.gz
    • 安装:pip install uwsgi-2.0.22.tar.gz
      【无功而返】
  4. 然后我打算从 required to install pyproject.toml-based projects 下手:
    • 安装 poetrypip install poetry
    • 然后,然后呢?
      【没下文了】
  5. 尝试直接安装 pyproject-toml:pip install pyproject-toml
    【无功而返】
  6. 然后决定从 gcc 缺少的那个文件下手,还真的发现一篇这样解决了问题的博客!!!
    • 文章链接:https://zhuanlan.zhihu.com/p/471389585
    • 不过由于操作起来过于麻烦,最后还是没有这样做。
      【知难而退】
  7. 最后偶然发现可以用 conda 直接安装。我真的,泪目了。
    在这里插入图片描述

参考文献
[1] Anaconda:https://anaconda.org/conda-forge/uwsgi
[2] 知乎文章:https://zhuanlan.zhihu.com/p/471389585

评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

鱼儿听雨眠

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值