Python install log (Python 3.10.2, Debian 5.10.0-11)

Python 3.10.2 を Debian 5.10.0-11に ソースコードからinstallしました.
(トラブルは少なめ)

libffi の install

wget https://github.com/libffi/libffi/releases/download/v3.4.2/libffi-3.4.2.tar.gz
tar xfz libffi-3.4.2.tar.gz
cd libffi-3.4.2/
./configure --prefix=/opt/libffi-3.4.2
make
su
mkdir /opt/libffi-3.4.2
make install
exit
cd ..

Python  3.10.2 の install

wget https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tgz
tar xfz Python-3.10.2.tgz
cd Python-3.10.2
./configure --includedir=/opt/libffi-3.4.2/include/ --prefix=/opt/Python-3.10.2/
make

もし

gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I./Include -I. -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/home/XXXX/Python-3.10.2/Include -I/home/XXXX/Python-3.10.2 -c /home/XXXX/Python-3.10.2/Modules/_ctypes/_ctypes.c -o build/temp.linux-x86_64-3.10/home/XXXX/Python-3.10.2/Modules/_ctypes/_ctypes.o -DPy_BUILD_CORE_MODULE
/home/XXXX/Python-3.10.2/Modules/_ctypes/_ctypes.c:107:10: fatal error: ffi.h: No such file or directory
107 | #include <ffi.h>
| ^~~~~~~
compilation terminated.

となってしまったら

libffi の install と ./configureの --includedir=/opt/libffi-3.4.2/include/ を忘れている。

su
mkdir /opt/Python-3.10.2/
make install
exit

/opt/Python-3.10.2/bin/python3 --version
	Python 3.10.2

普通にrootでインストールするなら

apt -y install libffi-dev
wget https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tgz
tar xfz Python-3.10.2.tgz
cd Python-3.10.2
./configure
make
make install
/usr/local/bin/python3 --version
	Python 3.10.2

この記事が気に入ったらサポートをしてみませんか?