'Is there a way to rebuild python on Ubuntu 14.04?
Some downloads are failing due to Python not being built with the --enable-shared tag, is there some way to get rid of the version I have and rebuild python? Or even better, just change it without reinstalling?
Solution 1:[1]
You can rebuild python, and pass --enable-shared to ./configure
Just follow:
For python 3: https://docs.python.org/3/using/unix.html#building-python
For Python 2: https://docs.python.org/2/using/unix.html#building-python
Be careful with the things in your distribution that require python, make sure you set the Python Path properly. And check if any of them requires any special configuration flags.
Solution 2:[2]
You can install different Python versions (side-by-side even) using pythonz: http://saghul.github.io/pythonz/
Basically, after installing it, you run a command to download and install Python with the version you want:
pythonz install 3.5.1
To pass custom compiling options, use --configure "... options here" as per documentation here.
It even supports PyPy and Jython.
I've been using it with success for the past year or so, it has made my life of testing projects in different Python versions much easier -- highly recommended.
Solution 3:[3]
Get sources with:
apt-get source python2.7
in the downloaded directory, change in python2.7.../debian/rules:
with_interp := static
#with_interp := shared
to
#with_interp := static
with_interp := shared
Then at the same level as the debian directory, run dpkg-buildpackage. You'll get ready .deb packages one directory higher. Just install them with dpkg -i python2.7.....deb
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | PeCosta |
| Solution 2 | Elias Dorneles |
| Solution 3 | viraptor |
