Monday, February 5, 2024

Install Python 3.12 && Pycharm 2023.3 along with system-wide 3.11 on SparkyLinux 7.2 (kernel 6.7.3)

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, without any additional  doubt. Same schema would work on SparkyLinux 2024.1

boris@boris-sparky72:~$ sudo apt install build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git

boris@boris-sparky72:~$ git clone \ https://github.com/pyenv/pyenv.git ~/.pyenv
Cloning into '/home/boris/.pyenv'...
remote: Enumerating objects: 23800, done.
remote: Counting objects: 100% (2311/2311), done.
remote: Compressing objects: 100% (349/349), done.
remote: Total 23800 (delta 2036), reused 2128 (delta 1925), pack-reused 21489
Receiving objects: 100% (23800/23800), 4.75 MiB | 4.74 MiB/s, done.
Resolving deltas: 100% (16150/16150), done.
boris@boris-sparky72:~$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
boris@boris-sparky72:~$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
boris@boris-sparky72:~$ echo 'eval "$(pyenv init --path)"' >> ~/.bashrc
boris@boris-sparky72:~$ source ~/.bashrc
 
boris@boris-sparky72:~$ pyenv install 3.12.1
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

boris@boris-sparky72:~$ sudo snap install pycharm-community --classic
pycharm-community 2023.3.3 from jetbrains installed

boris@boris-sparky72:~$ pyenv global 3.12.1
boris@boris-sparky72:~$ python3.12
Python 3.12.1 (main, Feb  5 2024, 08:34:42) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Any other user on Sparky 7.2 box would work with system wide 3.11.2

Switching Pycharm ( for user "boris") to 3.12.1 interpreter
















No comments:

Post a Comment