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
私が理解したのは、2つの変数を設定する必要がありますが、どうすればよいか$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