升级到 Ubuntu 23.04 后,我的 Python 安装不再起作用。
《运行诗》给出了以下内容:
➜ ~ poetry
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = '/home/guillaume/.local/share/pypoetry/venv/bin/python'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/home/guillaume/.local/share/pypoetry/venv/bin/python'
sys.base_prefix = '/usr'
sys.base_exec_prefix = '/usr'
sys.platlibdir = 'lib'
sys.executable = '/home/guillaume/.local/share/pypoetry/venv/bin/python'
sys.prefix = '/usr'
sys.exec_prefix = '/usr'
sys.path = [
'/usr/lib/python310.zip',
'/usr/lib/python3.10',
'/usr/lib/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 0x00007ff0fb4b1040 (most recent call first):
<no Python frame>
运行 python 本身确实有效:
➜ ~ python3
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
我试过 :
- 重新安装Python
- 取消设置
PYTHONHOME
和PYTHONPATH
如何修复我的 Python 设置?
答案1
回答我自己的问题以供将来参考。
我忽略了显而易见的事情。这个问题与诗歌有关。重新安装 Poetry 解决了这个问题。