When I wanted to use Tensorflow I found out that it requires Python 3.6 and
does not work with Python 3.7. However, Archlinux already uses Python 3.7.
Besides, when Python 3.7 came out Scrapy also failed with 3.7, because
async as variable names and Python 3.7 defined
async as a
Thus, I was confronted with installing a different version of Python. With virtual environments different versions of Python are simple to use, but you still have to install Python yourself first.
For this, go to the Python Releases page and download the version you want to install. Unzip the archive and change into the directory. In the directory execute:
./configure --prefix=$PATH_TO_INSTALL make && make install
This will install python to
$PATH_TO_INSTALL. I usually set this to a
To simplify the installation I created a bash script that does all the work:
#!/usr/bin/env bash VERSION=$1 TMP_FOLDER=/tmp wget -O $TMP_FOLDER/Python-$VERSION.tgz https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tgz if [ $? -ne 0 ]; then echo "Could not download Python $VERSION" exit 1 fi tar xf $TMP_FOLDER/Python-$VERSION.tgz -C $TMP_FOLDER mkdir -p $HOME/bin/python/$VERSION cd $TMP_FOLDER/Python-$VERSION \ && ./configure --prefix=$HOME/bin/python/$VERSION \ && make && make install \ && cd $HOME
To use it just call it with the desired Python version as argument and it will
install it to
You can then setup a virtual environment with this Python version:
virtualenv -p $HOME/bin/python/$VERSION/bin/python3 env