您的位置:首页 > 娱乐 > 明星 > web网页认证_音乐网站页面设计_谷歌关键词搜索工具_朋友圈广告

web网页认证_音乐网站页面设计_谷歌关键词搜索工具_朋友圈广告

2025/3/7 3:11:07 来源:https://blog.csdn.net/xun527/article/details/142546052  浏览:    关键词:web网页认证_音乐网站页面设计_谷歌关键词搜索工具_朋友圈广告
web网页认证_音乐网站页面设计_谷歌关键词搜索工具_朋友圈广告

一、问题描述

Django中,anconda环境下安装uwsgi,启动遇到的问题:

按照正常的启动方式启动:

uwsgi --ini uwsgi_py.ini

但是报错:

Traceback (most recent call last):File "/opt/myproject/myproject/wsgi.py", line 12, in <module>from django.core.wsgi import get_wsgi_applicationFile "/root/anaconda3/envs/xxx/lib/python3.11/site-packages/django/__init__.py", line 1, in <module>from django.utils.version import get_versionFile "/root/anaconda3/envs/xxx/lib/python3.11/site-packages/django/utils/version.py", line 1, in <module>import datetimeFile "/root/anaconda3/envs/xxx/lib/python3.11/datetime.py", line 12, in <module>import math as _math
ImportError: /root/anaconda3/envs/lottery/lib/python3.11/lib-dynload/math.cpython-311-x86_64-linux-gnu.so: undefined symbol: _PyModule_Add
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 43924)
spawned uWSGI worker 1 (pid: 43925, cores: 1)
spawned uWSGI worker 2 (pid: 43926, cores: 1)
spawned uWSGI worker 3 (pid: 43927, cores: 1)
spawned uWSGI http 1 (pid: 43928)
--- no python application found, check your startup logs for errors ---
--- no python application found, check your startup logs for errors ---
--- no python application found, check your startup logs for errors ---
--- no python application found, check your startup logs for errors ---

二、分析原因

uwsgi没有起来

三、解决办法:

不管怎么改配置都报这个错,网上很多解答,但是没有成功的。

这个问题的关键是:在anaconda 环境下安装uwsgi

pip install uwsgi

这个不行的,安装成功,但是anaconda环境下使用就会出这个问题。

所以要在anaconda下使用uwsgi,请按照下面的方式去安装:

anaconda search -t conda uwsgianaconda show conda-forge/uwsgiconda install --channel https://conda.anaconda.org/conda-forge uwsgi 

用conda安装uwsgi就可以了。这个应该和conda的环境有关系。

四、附加:

如果还出现问题,估计python版本与uwsgi不兼容,解决办法如下:

1、anconda环境下新建环境:
conda create -n ps39 python=3.9
2、进入指定的环境
conda activate ps39
3、重新运行代码
uwsgi --ini uwsgi_py.ini
4、查看日志,程序运行正常
*** Starting uWSGI 2.0.21 (64bit) on [Wed Sep 25 08:38:32 2024] ***
compiled with version: 11.2.0 on 05 August 2024 19:30:51
os: Linux-5.4.0-196-generic #216-Ubuntu SMP Thu Aug 29 13:26:53 UTC 2024
nodename: python
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 16
current working directory: /root/app/text_detection/script
writing pidfile to /root/app/text_detection/script/pid_uwsgi.pid
detected binary path: /opt/anaconda/install/envs/ps39/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
chdir() to /root/app/text_detection
your processes number limit is 128219
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 172.16.13.157:8010 fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Python version: 3.9.19 (main, May  6 2024, 19:43:03)  [GCC 11.2.0]
Python main interpreter initialized at 0xfff4f0
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 403077 bytes (393 KB) for 2 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0xfff4f0 pid: 868081 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 868081)
spawned uWSGI worker 1 (pid: 868082, cores: 1)
spawned uWSGI worker 2 (pid: 868083, cores: 1)

版权声明:

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

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