无法在raspbian上安装python3.10:无法设置$PYTHONHOME和$PYTHONPATH

无法在raspbian上安装python3.10:无法设置$PYTHONHOME和$PYTHONPATH

我尝试Python3.10通过发出以下命令在 Raspbian 11 上安装

wget https://www.python.org/ftp/python/3.10.11/Python-3.10.11.tgz
tar -zxvf Python-3.10.11.tgz
cd Python-3.10.11
./configure --enable-optimizations
sudo apt update
sudo apt install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev
sudo apt install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev

但我收到以下错误:

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 = './python'
  isolated = 0
  environment = 0
  user site = 1
  import site = 0
  sys._base_executable = '/root/Python-3.10.11/python'
  sys.base_prefix = '/usr/local'
  sys.base_exec_prefix = '/usr/local'
  sys.platlibdir = 'lib'
  sys.executable = '/root/Python-3.10.11/python'
  sys.prefix = '/usr/local'
  sys.exec_prefix = '/usr/local'
  sys.path = [
    '/usr/local/lib/python310.zip',
    '/usr/local/lib/python3.10',
    '/usr/local/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 0xf78e6010 (most recent call first):
  <no Python frame>
generate-posix-vars failed
make: *** [Makefile:615: pybuilddir.txt] Error 1

据我了解,我需要设置两个变量$PYTHONHOME$PYTHONPATH,但我不知道该怎么做。

有用的信息:

root@server:~/Python-3.10.11# whereis python3
python3: /usr/bin/python3.9 /usr/bin/python3 /usr/lib/python3.9 /usr/lib/python3 /etc/python3.9 /etc/python3 /etc/python3.7 /usr/local/bin/python3.10 /usr/local/bin/python3.9 /usr/local/bin/python3.9-config /usr/local/bin/python3 /usr/local/bin/python3.8-config /usr/local/bin/python3.8 /usr/local/lib/python3.9 /usr/local/lib/python3.7 /usr/local/lib/python3.8 /usr/include/python3.9 /usr/share/python3 /usr/share/man/man1/python3.1.gz

相关内容