Skip to content

Instantly share code, notes, and snippets.

@jonfk
Last active February 28, 2023 02:22
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save jonfk/26556a549c2accbd8c16 to your computer and use it in GitHub Desktop.
Save jonfk/26556a549c2accbd8c16 to your computer and use it in GitHub Desktop.
Python Virtualenv Cheatsheet

Virtualenv Cheatsheet

  1. Create a virtualenv

    $ virtualenv env
  2. Activate

    $ source env/bin/activate
  3. Create requirements.txt

    $ env/bin/pip freeze > requirements.txt
    # install the requirements to another env
    $ virtualenv env2
    $ env2/bin/pip install -r requirements.txt
  4. Deactive the virtual env

    $ deactivate
@ChaiBapchya
Copy link

Add the command to specify python version

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