Skip to content

Instantly share code, notes, and snippets.

@noelmathewisaac
Last active December 17, 2022 14:24
Show Gist options
  • Save noelmathewisaac/0f24baa4f454cf514f2b20285c10afe5 to your computer and use it in GitHub Desktop.
Save noelmathewisaac/0f24baa4f454cf514f2b20285c10afe5 to your computer and use it in GitHub Desktop.
Python Virtual Environment Commands

#Python Commands

Python Virtual Environment on Linux

  1. Create the virtual environment. (The required python version can be specified)
    python3.8 -m venv venv-name
  2. Activate the enviroment
    source venv-name/bin/activate

Importing files from folder in parent directory

import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment