Pyenv is a tool for managing multiple Python versions. Once pyenv is installed you can easily switch between one project that uses Python 3.12 and a system-wide default Python 3.11. Same approach works fine on openSUSE Tumbleweed, SparkyLinux 7.2, SparkyLinux 2024.1
$ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
or
$ sudo pacman -S pyenv
The following two installs are required to perform successful build Python 3.12.1 for particular user via pyenv. This build won't affect system-wide Python 3.11.6
$ sudo pacman -S base-devel
$ sudo pacman -S tk
Now we update ~/.zshrc in the same way as did it for ~/.bashrc in cases mentioned above .
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
$ echo 'eval "$(pyenv init --path)"' >> ~/.zshrc
Downloading Python-3.12.1.tar.xz...
-> https://www.python.org/ftp/python/3.12.1/Python-3.12.1.tar.xz
Installing Python-3.12.1...
Installed Python-3.12.1 to /home/boris/.pyenv/versions/3.12.1
$ pyenv global 3.12.1
Icon name: computer-vm
Chassis: vm
Machine ID: a40511262c5e4e96902bd833e128010a
Boot ID: 8e9143ffb5a04aff81d5528c9282cd52
Virtualization: kvm
Operating System: Manjaro Linux
Kernel: Linux 6.7.0-0-MANJARO
Architecture: x86-64
Hardware Vendor: QEMU
Hardware Model: Standard PC _Q35 + ICH9, 2009_
Firmware Version: 1.16.3-1.fc39
Firmware Date: Tue 2014-04-01
Firmware Age: 9y 10month 1w
$ python3.12 Python 3.12.1 (main, Feb 7 2024, 09:08:17) [GCC 13.2.1 20230801] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ python3.11 Python 3.11.6 (main, Nov 14 2023, 09:36:21) [GCC 13.2.1 20230801] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
No comments:
Post a Comment