You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Создайте переменную окружения PYTHON_VERSION. Cписок доступных версий можно увидеть на странице загрузки Python
PYTHON_VERSION=3.9.6
Загрузите и распакуйте исходный код
cd /tmp/ \
&& wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz \
&& tar -xf Python-${PYTHON_VERSION}.tgz
Выполните configure сценарий:
cd Python-${PYTHON_VERSION} \
&& sudo ./configure \
--enable-optimizations \
--prefix=/opt/Python-${PYTHON_VERSION}
Соберите Python. Значение параметра -j должно соответствовать числу, полученному при выводе команды nproc
make -j 4
Установите собранный Python
sudo make altinstall
Удалите файлы сборки
cd ~ && sudo rm -rf /tmp/Python-${PYTHON_VERSION}*
Добавьте скрипт для обновления переменной окружения PATH
nano .bashrc
#########################################
# Append python bin directories to PATH #
#########################################
for path in $(find /opt/Python* -name "bin" -type d); do
if [ -d "$path" ] && [[ ":$PATH:" != *":$path:"* ]]; then
PATH="$path${PATH:+":$PATH"}"
fi
done