Skip to content

Instantly share code, notes, and snippets.

@ehbc221
Last active August 30, 2024 19:59
Show Gist options
  • Save ehbc221/b244a1e19982c63f2b98a0fa91235e2b to your computer and use it in GitHub Desktop.
Save ehbc221/b244a1e19982c63f2b98a0fa91235e2b to your computer and use it in GitHub Desktop.
Install Python 3 and create a virtual environment for projects
# Install Python 3
$ sudo apt-get install python3
# Install python3-virtualenv
$ sudo apt-get install python3-virtualenv
# You can checkout you virtualenv version
$ virtualenv --version
# Create you virtualenv in the folder you that want to
$ cd /my/path/to/my/venv/folder/container
$ virtualenv --python=/your/path/to/python3 your/virtualenv/folder/name
# Example
$ cd /myprojects
$ virtualenv --python=/usr/bin/python3.7 venv
# Check if the folder was created
$ ls
# Activate your virtualenv
$ source venv/bin/activate
# Check yuo python version on this virtualenv
python --version
# Check yuo pip version on this virtualenv
$ pip --version
# When you finish working, you can deacgtivate your virtualenv
$ deavtivate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment