Installing Python 3.6.2 on WSL
I've been doing a lot of Python work lately. Since I've got a couple of young kids that keep me busy, I have to sneak time on the laptop upstairs. It's a Mac so most Linux-y things work as you'd expect.
Sometimes, though, my wife wants to use her computer and I'm relegated to Windows in the basement. Unfortunately, the tool I'm building needs readline
, which isn't available on Windows, and pyreadline
was throwing errors. I'd dabbled a bit with WSL and had been really impressed with how well it works so I decided to give it a shot.
And then I realized that I'd used f-strings throughout, which were brought in with Python 3.6, and Ubuntu 16.04 LTS uses 3.5.2, so down the rabbit hole we went.
Here's what you need to do to get Python 3.6.2 and virtualenv running in bash on Ubuntu on Windows.
Packages
First we start with the bits. Python 3.6 isn't available through apt
, so you'll need to add a ppa first:
|
|
Next, update and install Python3
|
|
Python Configuration
Python3 by default will be 3.5.2, which won't do.
|
|
You can then toggle between the two using sudo update-alternatives --config python3
. Once you've finished getting virtualenvwrapper sorted, you can change back to 3.5.
virtualenv Configuration
Next, we're going to upgrade pip because OCD and install virtualenv and virtualenvwrapper.
|
|
Edit your ~/.bashrc
|
|
Finally load all the goodies with source ~/.bashrc
.
Bonus
I like workon <environment name>
to dump me in the project directory. To do this, add the following to ~/.virtualenv/postactivate
|
|