This is a revisiting of a previous post setting up Ubuntu 16.04LTS. In this previous post I installed Python 3.5 from the Ubuntu/Debian repo. It was a breeze. Now that I want Python 3.6.1, however, it is not as easy. Some dependencies are not well documented and I had to find them through trial-and-error. This post documents the process.
This is a work in progress as you will see we are stuck in some last dependencies.
System spec
Ubuntu 16.04 LTS
Steps
Initial run
- Download source
./configure
make
This will show a list of Ubuntu packages that are missing for optional packages. It is fine if you don’t really care to use those features, though. Normal system programming / data science applications are not really affected.
Ubuntu packages to install
This may not be a complete list, but here are some of them. It should be possible to sudo apt-get install
all of them .
Packages | Other packages |
---|---|
libc6 | |
build-essential | |
libreadline6 | -dev |
libsqlite3-dev | |
libbz2-dev | |
libgdbm-dev | |
liblzma5 | liblzma-dev/liblzma-doc |
libssl-dev | -doc |
libncurses5 | -dev/-doc |
libncursesw5 | -dev/-doc |
tk-dev |
Alternatively just copy paste the following
|
|
Tkinter
Note that previously there was a problem with Tkinter dependency and I was not able to find the correct dependency.
But this is officially solved by installing tk-dev
package.
Version control
I recommend pyenv for managing multiple versions of python. It integrates well with virtualenv
so you can not only swtich between python versions seamlessly but also create virtual environment of desired python version on the fly. Now that all Ubuntu comes with Py2.7 and Py3.5 built-in this will be handy.
The easiest way to install pyenv
is by running the auto-installer
|
|
With all the dependencies installed. We can install with pyenv this way
|
|
The first line asks configure
to use optimization for Python 3.6. See the discussion about the flag. According to here the flag will make the compiled binary 10% faster, which I think is worth trying out.