Question

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
Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top