Update homeassistant-core-install.sh

Compile Python from its source
This commit is contained in:
tteckster 2024-02-08 21:12:03 -05:00 committed by GitHub
parent f267ee196e
commit c0856c0d0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 29 deletions

View File

@ -42,41 +42,30 @@ $STD apt-get install -y \
libatlas-base-dev libatlas-base-dev
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Updating Python3" RELEASE=$(curl -s https://www.python.org/downloads/ | grep -oP 'Download Python \K\d+\.\d+\.\d+' | head -1)
$STD apt-get install -y \
python3 \
python3-dev \
python3-pip \
python3-venv
msg_ok "Updated Python3"
msg_info "Installing pyenv" msg_info "Compiling Python ${RELEASE} from its source (Additional Patience)"
$STD apt-get remove -y python3
$STD apt-get install -y \ $STD apt-get install -y \
make \ checkinstall \
libreadline-dev \ libreadline-dev \
libsqlite3-dev \
libncurses5-dev \
libncursesw5-dev \ libncursesw5-dev \
xz-utils \ libssl-dev \
libsqlite3-dev \
tk-dev \ tk-dev \
llvm \ libgdbm-dev \
libbz2-dev \ libc6-dev \
libxml2-dev \ libbz2-dev
libxmlsec1-dev \
liblzma-dev
$STD git clone https://github.com/pyenv/pyenv.git ~/.pyenv
set +e
echo 'export PYENV_ROOT="$HOME/.pyenv"' >>~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >>~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\nfi' >>~/.bashrc
msg_ok "Installed pyenv"
. ~/.bashrc
set -e wget -qO- https://www.python.org/ftp/python/${RELEASE}/Python-${RELEASE}.tar.xz | tar -xJ
msg_info "Installing Python 3.12.1 (Patience)" cd Python-${RELEASE}
$STD pyenv install 3.12.1 $STD ./configure --enable-optimizations
pyenv global 3.12.1 $STD make -j $(nproc)
msg_ok "Installed Python 3.12.1" $STD make altinstall
$STD update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.12 1
cd ~
rm -rf Python-${RELEASE}
msg_ok "Installed Python ${RELEASE}"
msg_info "Installing Home Assistant-Core" msg_info "Installing Home Assistant-Core"
mkdir /srv/homeassistant mkdir /srv/homeassistant