Django 无法启动uwsgi,uwsgi 2.0.18和python 3.6.9中存在编码错误

Django 无法启动uwsgi,uwsgi 2.0.18和python 3.6.9中存在编码错误,django,nginx,uwsgi,Django,Nginx,Uwsgi,我在使用nginx启动django项目中的uwsgi时遇到了严重的问题。我甚至试着运行plugins=python36,但还是失败了。我查过了,但帮不了我。我仍然不知道如何修复ModuleNotFoundError:没有名为“encodings”的模块。你能给我一些建议和帮助吗?谢谢 以下是版本信息: Python 3.6.9 uwsgi 2.0.18 nginx版本:nginx/1.14.0(Ubuntu) /usr/local/bin/uwsgi 运行sudo-uwsgi--ini/us

我在使用nginx启动django项目中的uwsgi时遇到了严重的问题。我甚至试着运行plugins=python36,但还是失败了。我查过了,但帮不了我。我仍然不知道如何修复
ModuleNotFoundError:没有名为“encodings”的模块
。你能给我一些建议和帮助吗?谢谢

以下是版本信息:

  • Python 3.6.9
  • uwsgi 2.0.18
  • nginx版本:nginx/1.14.0(Ubuntu)
  • /usr/local/bin/uwsgi
运行
sudo-uwsgi--ini/usr/share/nginx/html/portal/portal\u-uwsgi.ini时出现以下错误

[uWSGI] getting INI configuration from /usr/share/nginx/html/portal/portal_uwsgi.ini
open("./python3_plugin.so"): No such file or directory [core/utils.c line 3724]
!!! UNABLE to load uWSGI plugin: ./python3_plugin.so: cannot open shared object file: No such file or directory !!!
*** Starting uWSGI 2.0.18 (64bit) on [Thu Jun 18 22:51:54 2020] ***
compiled with version: 7.5.0 on 11 June 2020 23:01:20
os: Linux-5.3.0-59-generic #53~18.04.1-Ubuntu SMP Thu Jun 4 14:58:26 UTC 2020
machine: x86_64
clock source: unix
detected number of CPU cores: 4
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /usr/share/nginx/html/portal
your processes number limit is 63773
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
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 UNIX address /tmp/uwsgi.sock 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.6.9 (default, Apr 18 2020, 01:56:04)  [GCC 8.4.0]
Set PythonHome to /usr/share/nginx/html/portal
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f962e59e640 (most recent call first):
Aborted
[uwsgi]

# Django-related settings
# the base directory (full path)
chdir           = /usr/share/nginx/html/portal
# Django's wsgi file
module          = config.wsgi
# the virtualenv (full path)
home            = /usr/share/nginx/html/portal

# process-related settings
# master
master          = true
# maximum number of worker processes
processes       = 10
# the socket (use the full path to be safe
socket          = /tmp/uwsgi.sock
# ... with appropriate permissions - may be needed
chmod-socket    = 666
# clear environment on exit
vacuum          = true
# Reload worker to avoid memory leak
max-requests    = 5000
# Recycle worker if a request to it takes longer than specified seconds
harakiri        = 90

plugins = python3
以下是
/usr/share/nginx/html/portal/portal\u uwsgi.ini

[uWSGI] getting INI configuration from /usr/share/nginx/html/portal/portal_uwsgi.ini
open("./python3_plugin.so"): No such file or directory [core/utils.c line 3724]
!!! UNABLE to load uWSGI plugin: ./python3_plugin.so: cannot open shared object file: No such file or directory !!!
*** Starting uWSGI 2.0.18 (64bit) on [Thu Jun 18 22:51:54 2020] ***
compiled with version: 7.5.0 on 11 June 2020 23:01:20
os: Linux-5.3.0-59-generic #53~18.04.1-Ubuntu SMP Thu Jun 4 14:58:26 UTC 2020
machine: x86_64
clock source: unix
detected number of CPU cores: 4
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /usr/share/nginx/html/portal
your processes number limit is 63773
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
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 UNIX address /tmp/uwsgi.sock 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.6.9 (default, Apr 18 2020, 01:56:04)  [GCC 8.4.0]
Set PythonHome to /usr/share/nginx/html/portal
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f962e59e640 (most recent call first):
Aborted
[uwsgi]

# Django-related settings
# the base directory (full path)
chdir           = /usr/share/nginx/html/portal
# Django's wsgi file
module          = config.wsgi
# the virtualenv (full path)
home            = /usr/share/nginx/html/portal

# process-related settings
# master
master          = true
# maximum number of worker processes
processes       = 10
# the socket (use the full path to be safe
socket          = /tmp/uwsgi.sock
# ... with appropriate permissions - may be needed
chmod-socket    = 666
# clear environment on exit
vacuum          = true
# Reload worker to avoid memory leak
max-requests    = 5000
# Recycle worker if a request to it takes longer than specified seconds
harakiri        = 90

plugins = python3

您是否尝试过设置Python主目录(PYTHONHOME)。找不到编码模块主要意味着它找不到库diryes我确实导出了PYTHON=/usr/bin/python3.6,但仍然失败了
PYTHON
!=<代码>PYTHONHOME
我做了以下操作,但仍然是一样的。我不明白为什么错误会说
将PythonHome设置为/usr/share/nginx/html/portal
,因为这不是python3的主位置。哪个python3/usr/bin/python3
export PYTHONHOME=/usr/bin/python3
,我在virtualenv内部和外部都进行了尝试,得到了相同的uwsgi错误。有什么建议吗?请帮助您是否尝试设置Python主目录(PYTHONHOME)。找不到编码模块主要意味着它找不到库diryes我确实导出了PYTHON=/usr/bin/python3.6,但仍然失败了
PYTHON
!=<代码>PYTHONHOME我做了以下操作,但仍然是一样的。我不明白为什么错误会说
将PythonHome设置为/usr/share/nginx/html/portal
,因为这不是python3的主位置。哪个python3/usr/bin/python3
export PYTHONHOME=/usr/bin/python3
,我在virtualenv内部和外部都进行了尝试,得到了相同的uwsgi错误。有什么建议吗?请帮忙