Build any python version for venv: Difference between revisions
Jump to navigation
Jump to search
Line 23: | Line 23: | ||
make install | make install | ||
run/bin/python3 --version | run/bin/python3 --version | ||
Newer script getpy.sh [ver [dir]]: | |||
#!/bin/bash | |||
# get version (like available in ftp_url) and directory where to install | |||
# needs relevant dev packages installed: | |||
# zypper in tk-devel sqlite3-devel gdbm-devel readline6-devel openssl-devel libffi-devel | |||
ver="${1-3.10.10}" | |||
dir="${2-$PWD}" | |||
instdir="$dir/python-$ver" | |||
echo "Installing python to '$instdir'" | |||
mkdir -p "$instdir" | |||
cd "$instdir" | |||
wget -O- "https://www.python.org/ftp/python/$ver/Python-$ver.tar.xz" | tar xJf - | |||
cd "Python-$ver" | |||
./configure --enable-optimizations --with-lto=full --prefix="$instdir" --libdir="$instdir/lib" | |||
make -j8 | |||
make install | |||
"$instdir/bin/python3" -m venv "$instdir/venv/base" | |||
. "$instdir/venv/base/bin/activate" | |||
python3 --version | |||
== Use The Build == | == Use The Build == |
Revision as of 11:33, 8 February 2023
Build Python
work in progress
Status: builds and run/bin/python3 --version works. But venv, pip or interpreter mode do not.
Asked for help: https://discuss.python.org/u/joba-1/activity (github based account)
Prerequisites
Most should be there, check https://devguide.python.org/getting-started/setup-building/index.html#install-dependencies for details
zypper in tk-devel sqlite3-devel gdbm-devel readline6-devel openssl-devel libffi-devel
User Build
ver=3.11.1 cd wget -O- https://www.python.org/ftp/python/${ver}/Python-${ver}.tar.xz | tar xJf - cd Python-${ver} ./configure --enable-optimizations --with-lto=full --prefix=$PWD/run --libdir=$PWD/run/lib make -j8 make install run/bin/python3 --version
Newer script getpy.sh [ver [dir]]:
#!/bin/bash # get version (like available in ftp_url) and directory where to install # needs relevant dev packages installed: # zypper in tk-devel sqlite3-devel gdbm-devel readline6-devel openssl-devel libffi-devel ver="${1-3.10.10}" dir="${2-$PWD}" instdir="$dir/python-$ver" echo "Installing python to '$instdir'" mkdir -p "$instdir" cd "$instdir" wget -O- "https://www.python.org/ftp/python/$ver/Python-$ver.tar.xz" | tar xJf - cd "Python-$ver" ./configure --enable-optimizations --with-lto=full --prefix="$instdir" --libdir="$instdir/lib" make -j8 make install "$instdir/bin/python3" -m venv "$instdir/venv/base" . "$instdir/venv/base/bin/activate" python3 --version
Use The Build
run/bin/python3 --version
run/bin/python3 -m venv /new/env/path
. /new/env/path/bin/activate
pip install anything...