Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing newest Python on openSUSE

I installed Python on an openSUSE system (see version below) using the Zypper package manager. This gives me Python 3.2, but some packages require Python 3.3. Updating with zypper update python3 stays on Python 3.2. How can I upgrade to 3.3, ideally using the package manager and reusing the rest of my working Python installation (site packages, pip...)?

openSUSE 12.2 (x86_64)
VERSION = 12.2
CODENAME = Mantis
like image 607
clstaudt Avatar asked Sep 18 '13 14:09

clstaudt


People also ask

How do I update python in Opensuse?

You can add the devel:languages:python:Factory repository or use the 1 Click Install and a Python 3.3. 2 version form here (e.g. from the above repo). You could use e.g. 50 as priority if your other repos have the standard priority of 99. Then use zypper update python3 to update python.


2 Answers

You can add the devel:languages:python:Factory repository or use the 1 Click Install and a Python 3.3.2 version form here (e.g. from the above repo).
(Show other versions->openSUSE 12.2->Show unstable packages->1 Click Install)

To use it with zypper only (no GUI) you can add the repo as follows:

sudo zypper ar http://download.opensuse.org/repositories/devel:/languages:/python:/Factory/openSUSE_12.2/devel:languages:python:Factory.repo

Then, to use packages from that repo you should give the repo a higher priority (in this case higher priority means lower number 0=high, 100=low). To know the repo id use zypper lr and search for the repo number in the output. Then use the following command to change the priority:

 sudo zypper mr -p priority repo_number

You could use e.g. 50 as priority if your other repos have the standard priority of 99.
Then use zypper update python3 to update python.

like image 115
TobiMarg Avatar answered Nov 09 '22 11:11

TobiMarg


You can follow the instructions below using pyenv:

# Step 1. Install pyenv

git clone https://github.com/pyenv/pyenv.git ~/.pyenv
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 -)"\nfi' >> ~/.bashrc

# Step 2. Install missing headers for all the Python modules to be built

sudo zypper install readline-devel sqlite3-devel libbz2-devel

# Step 3. Install the desired Python version

pyenv install 3.6.3

quoting from https://gist.github.com/antivanov/01ed4eac2d7486a170be598b5a0a4ac7

like image 44
Zouzias Avatar answered Nov 09 '22 10:11

Zouzias