DEV Community

TimothyAgevi
TimothyAgevi

Posted on

Python Introduction

Working with virtual environment

When working on a python project its always advisable to create for it a virtual environment.

Steps for doing that include :

  1. Navigate to the project's directory then

  2. Run python -venv dev
    -note dev is just the name of the virtual environment ,your free to name it however you prefer.

3.Activate the virtual environment using this command :
source dev/bin/activate

-Note if you are using windows run dev\Scripts\activate
instead.

  1. create a requirements.txt file using the command : ** pip freeze > requirements.txt**
  2. this file will contain all packages installed for thespecified project.

  3. Install any packages required using pip install

  4. Repeat command in step 4, to update the requirements.txt.

Top comments (0)