By compile the binary:
Download the zip package of python3.4 from here
extract it and enter in the folder
make -j 4 If you have more core insert the number of core of your cpu
make test -j 4 same as above, OPTIONAL but suggested!
sudo make install
If you find the binary package you can skip the compilation steps.
sudo apt install virtualenv
then create a virtual environment with desired python version:
virtualenv --python=python3.4 --clear --always-copy --setuptools .venv
virtualenv .venv --distribute
.venv is the path where virtual environment is installed
Alternative to a virtual environment you can use the python executable directly from path you choose, but I recommend you to use a virtual environment, keep your system more clean.
to activate the virtual environment execute the bash script perform following steps:
to exit from the virtualenv
exit will close the terminal and the virtualenv.
You can also configure mostly of IDE to use the python virtual env.