欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 教育 > 锐评 > ubuntu22.04安装Python的uwsgi

ubuntu22.04安装Python的uwsgi

2024/10/24 1:58:02 来源:https://blog.csdn.net/xiaofeixia666888/article/details/143162577  浏览:    关键词:ubuntu22.04安装Python的uwsgi

1.下载uwsgi安装包:uWSGI 2.0.21 — uWSGI 2.0 documentation

uwsgi2.0.21下载地址:https://files.pythonhosted.org/packages/b3/8e/b4fb9f793745afd6afcc0d2443d5626132e5d3540de98f28a8b8f5c753f9/uwsgi-2.0.21.tar.gz

tar zxvf uwsgi-2.0.21.tar.gz
cd uwsgi-2.0.21
# 安装make  apt-get install make
make

报错 如下: 

python3 uwsgiconfig.py --build 
using profile: buildconf/default.ini
detected include path: ['/usr/include', '/usr/local/include']
Traceback (most recent call last):File "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 "uwsgiconfig.py", line 1618, in <module>uc = uConf(bconf, is_cflags)File "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
make: *** [Makefile:4: all] Error 1

 安装编译器

 apt-get install build-essential最后再make

pip安装uwsgi

apt-get install build-essential python3-dev
pip install uWSGI
  1. 运行方式和服务管理
    • Ubuntu 软件仓库安装
      • 在 Ubuntu 中,通过软件仓库安装的 uWSGI 可以作为系统服务来管理。可以使用systemctl命令来启动、停止和查看 uWSGI 服务的状态。
      • 例如,sudo systemctl start uwsgi可以启动 uWSGI 服务,sudo systemctl status uwsgi可以查看 uWSGI 服务的当前状态(如是否正在运行、是否有错误等)。
    • pip 安装
      • pip 安装的 uWSGI 通常需要在命令行中手动启动,或者通过在项目中编写脚本(如bash脚本或 Python 脚本)来启动。没有集成到系统服务管理中。
      • 例如,可以在项目目录下执行uwsgi --ini uwsgi.ini来启动 uWSGI,这里uwsgi.ini是项目的 uWSGI 配置文件。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com