Relevant date: 2018 May 30th
This works today but there is no guarantee this is the right way in a month and especially a year later.
After install WSL and then Debian linux, the first thing I did was something recommended from the reviews:
sudo apt update && sudo apt full-upgrade && sudo apt install aptitude sudo aptitude install ~pstandard ~prequired ~pimportant -F%
Googling led to some goofy answers like using a PPA (which isn’t a bad thing) but you can screw up your environment if not careful
So….. time to go old school and build from source.
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev sudo apt-get install -y libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm sudo apt-get install -y libncurses5-dev libncursesw5-dev xz-utils tk-dev
Those are the basic requirements BUT I am fairly certain somethings like lxml (for Beautiful Soup) will be missing. Not an issue if you don’t intend to use lxml AND they are not required for building the python 3.6 interpreter.
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz tar xvf Python-3.6.5.tgz cd Python-3.6.5 ./configure --enable-optimizations --with-ensurepip=install make sudo make altinstall
NOTE! you can do
make -j8
for a faster build time BUT ideally using
-j# where the # is the number of cores on your CPU
is better
NOTE! if you have a faster computer, the actual compile process is fairly quick but than it runs a post build unit testing suite that is absolutely massive because of the `–enable-optimizations` flag. If you need speed for a commercial environment AND you are 100% certain your environment across all machines is the same, just retar up the source directory with the pre-built binaries, send it to each machine, and then run `make altinstall`.
From there you can run
user@machine:~/$python3.6.5
some people recommend fiddling with
alternatives
so you can just do
user@machine:~/$python3.6.5
but generally I use virtualenv and explicitly make a new environment with my version of python to keep me sane.