【发布时间】:2021-03-18 22:46:27
【问题描述】:
我正在尝试在我的虚拟环境中启动我的 uwsgi 服务器,但是在我添加 plugin python3 选项后,我每次都会收到此错误:
!!! Python Home is not a directory: /home/env3/educ !!!
Set PythonHome to /home/env3/educ
Python path configuration:
PYTHONHOME = '/home/env3/educ'
PYTHONPATH = (not set)
program name = '/home/env3/educ/bin/python'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/home/env3/educ/bin/python'
sys.base_prefix = '/home/env3/educ'
sys.base_exec_prefix = '/home/env3/educ'
sys.executable = '/home/env3/educ/bin/python'
sys.prefix = '/home/env3/educ'
sys.exec_prefix = '/home/env3/educ'
sys.path = [
'/home/env3/educ/lib/python38.zip',
'/home/env3/educ/lib/python3.8',
'/home/env3/educ/lib/python3.8/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007efe89db8780 (most recent call first):
<no Python frame>
我还尝试使用python3 -m venv env 创建新的虚拟环境并将项目文件移到其中,但仍然出现相同的错误。
这是我的 uwsgi.ini 文件:
[uwsgi]
base = /home/env3/educ
projectname = educ
plugins = python3
master = true
virtualenv = /home/env3/%(projectname)
pythonpath = %(base)
env = DJANGO_SETTINGS_MODULE=%(projectname).settings.pro
module = %(projectname).wsgi:application
socket = /tmp/%(projectname).sock
chmod-socket = 666
我使用 Python 3.8.5
我正在尝试使用 Django + uWSGI + nginx + Postgresql
如果您需要更多详细信息,我会提供给它
谢谢
【问题讨论】:
-
我在启动 python 时也遇到了随机错误。不知道为什么会这样
-
在 WSL2 上遇到同样的问题,而且特别严重,因为我什至无法使用
apt而不得到这个:Reading package lists... Done E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi' E: Sub-process returned an error code。令人难以置信的令人沮丧,不幸的是 unset 在我的情况下不起作用。
标签: python django ubuntu uwsgi