Skip to content

Instantly share code, notes, and snippets.

@momota
Last active October 29, 2018 09:41
Show Gist options
  • Save momota/64ef2483a87b133ea99ca268bc362a80 to your computer and use it in GitHub Desktop.
Save momota/64ef2483a87b133ea99ca268bc362a80 to your computer and use it in GitHub Desktop.

environment

OS is Ubuntu 18.04.1 LTS.

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"

Default python's version is 2.x.

$ python -V
Python 2.7.15rc1

install python3-venv

$ sudo apt-get install python3-venv

create new venv

# python3 -m venv [new-venv-name]
$ python3 -m venv YOUR-VENV

activate venv

# source [new-venv-name]/bin/activate
# or
# . [new-venv-name]/bin/activate
$ source YOUR-VENV/bin/activate

Confirm the version of Python.

(YOUR-VENV) $ python -V
Python 3.6.6

deactivate

(YOUR-VENV) $ deactivate

Confirm the version of Python.

$ python -V
Python 2.7.15rc1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment