DEV Community

kenneth
kenneth

Posted on • Edited on

Starting a Python project

  1. $ mkdir ~/my_project Create project directory under user home.
  2. $ cd ~/my_project
  3. $ git init Create git repo.
  4. $ python -m venv venv Create virtual environment within the project directory. Preferred over a centralised virtual environments directory e.g. my_venvs/my_project as it is easier to find and manage. Not a hidden directory e.g. .venv for visibility.
  5. $ source venv/bin/activate 5a. $ source venv/Scripts/activate for Python 3.9+
  6. $ pip install pip --upgrade Because for some reason the virtual environment's pip is an older version?! Hints of Python dependency hell emerging.

Top comments (0)