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

관련 정보