Skip to content

Instantly share code, notes, and snippets.

@danielnagel
Last active September 10, 2019 17:26
Show Gist options
  • Save danielnagel/f3958797788ce63c00b9d1838fe7c7a3 to your computer and use it in GitHub Desktop.
Save danielnagel/f3958797788ce63c00b9d1838fe7c7a3 to your computer and use it in GitHub Desktop.
This is how you install Python3.7, pip and setup virtualenv. 🍻

Installing Python 🐍

Tested on Ubuntu 18.04 bionic [Ubuntu on Windows 10]

Because I often forget it, I wrote this reminder to myself. This is how you install Python3.7. It bothered me that i had to write python3.7, so I also mention here how to implement alias. As far as I know, aliasses only work on unix-like systems.

# Python 3.7 on WSL
$ sudo apt update
$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt install python3.7
# Changing aliasses
$ vim .zshrc # or .bashrc if you are using bash
# inside .zshrc
alias python="python3.7"
alias pip="python3.7 -m pip"
# close vim with ESC, :wq, ENTER
# Check if everything is installed right
$ python -V
Python 3.7.4
$ pip -V
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.7)

Virtual Environment

virtualenv is a tool to create isolated Python environments. virtualenv creates a folder which contains all the necessary executables to use the packages that a Python project would need. And again, I will add an alias.

$ pip install virtualenv
# Changing aliasses
$ vim .zshrc # or .bashrc if you are using bash
# inside .zshrc
$ alias virtualenv="python -m virtualenv"
# close vim with ESC, :wq, ENTER
# Check installation
$ virtualenv --version
16.7.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment