Python, 3.7.1 released recently. It has some exciting features. After downloading python source from python.org, I faced few problems in installing from source, like this zlib library problem. There were so many solutions, yet none of them are working for me. After searching for answers and banging my head on walls for a while, I finally found the solution on official python site’s build dependency documentation.
sudo apt-get build-dep python3.6
If you see something like this
E: You must put some 'source' URIs in your sources.list, Open Software & Updates and enable:
Source code, you can see details on this askubuntu Q&A.
If that package is not available for your system, try reducing the minor version until you find a package that is available in your system’s package manager.
Now, extract the source.
tar xzvf Python-3.*.tgz
Go to the extracted folder.
configure with the flag:
sudo make altinstall
*Alternatively, you can run the command:
sudo make install. But, this will replace your default python version with this new one, which may cause problems to your OS, and other libraries using default python.