Skip to content

Instantly share code, notes, and snippets.

@SimonJang
Forked from pandafulmanda/Python3 Virtualenv Setup.md
Last active September 23, 2019 16:35
Show Gist options
  • Save SimonJang/1edc490e784150a900988176ddc285c3 to your computer and use it in GitHub Desktop.
Save SimonJang/1edc490e784150a900988176ddc285c3 to your computer and use it in GitHub Desktop.
Setting up and using Python3 Virtualenv on Mac/Linux

Python3 Virtualenv Setup

Requirements
  • Python 3
  • Pip 3
$ brew install python3

Pip3 is installed with Python3

Installation

To install virtualenv via pip run:

$ pip3 install virtualenv
Usage

Creation of virtualenv:

$ virtualenv -p python3 <desired-path>

Activate the virtualenv:

$ source <desired-path>/bin/activate

Deactivate the virtualenv:

$ deactivate

About Virtualenv

Create a requirements.txt file containing the dependencies

pip freeze > requirements.txt

Install dependencies based on requirements.txt file

pip install -r requirements.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment