python - uwsgi 错误 - ModuleNotFoundError:没有名为“编码”的模块?
问题描述
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
setuid() to 1000
your processes number limit is 5568
your memory page size is 4096 bytes
detected max file descriptor number: 2560
lock engine: OSX spinlocks
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on 127.0.0.1:8000 fd 4
uwsgi socket 0 bound to TCP address 127.0.0.1:62444 (port auto-assigned) fd 3
Python version: 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53) [Clang 6.0 (clang-600.0.57)]
!!! Python Home is not a directory: /Portenv !!!
Set PythonHome to /Portenv
Python path configuration:
PYTHONHOME = '/Portenv'
PYTHONPATH = (not set)
program name = '/Portenv/bin/python'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/Portenv/bin/python'
sys.base_prefix = '/Portenv'
sys.base_exec_prefix = '/Portenv'
sys.executable = '/Portenv/bin/python'
sys.prefix = '/Portenv'
sys.exec_prefix = '/Portenv'
sys.path = [
'/Portenv/lib/python38.zip',
'/Portenv/lib/python3.8',
'/Portenv/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 0x00000001136aadc0 (most recent call first):
<no Python frame>
我尝试了其他一些堆栈溢出的答案,但我对 Django 很陌生,有些答案太模糊了当我尝试初始化 uwsgi 时出现此错误。提前感谢任何人可以提供的任何帮助
解决方案
此问题已在此线程中解决。如果您以管理员身份运行 python setup 或已永久设置PYTHONHOME
,则可能会导致错误。
撤消必要的操作,它应该可以解决您的问题。
推荐阅读
- django - 我试图弄清楚 Django 的功能并遇到了这个递归错误
- git - 从谷歌云平台克隆一个 git repo
- postgresql - 带有 count(*) 查询的 Ecto union_all
- mongodb - 如何使用 PyMongo 在 MongoDB 中获取不同的名称和计数
- python - 在 pandas read_csv 中以毫秒为单位解析日期
- python - 使用 urlencode 转义句点
- java - Selenium 使用构建信息抛出 TimeoutException:版本:“未知”,修订:“未知”,时间:“未知”,然后使用 Burp 正确加载页面
- javascript - 在 JavaScript+Node.js 中如何等待上一个 post 请求完成?
- c# - 您可以在运行时设置 XmlRootAttribute 中的命名空间字段吗?
- windows - WTSClientInfo 在 Windows 10 操作系统上通过 RDP 连接返回 NULL