Create and manage a virtual environment within your project folder, follow these steps:
(*All steps for Windows operating system.)
Navigate to Your Project Folder:
Open your terminal or command prompt and navigate to the root directory of your project where you want to create the virtual environment.
Create a Virtual Environment:
In the terminal, run the following command to create a virtual environment named venv (you can choose a different name if you prefer):
Deactivate the Virtual Environment:
When you're done working on your project, you can deactivate the virtual environment:
%%Create a Virtual Environment%%
python -m venv venv
%%Activate the Virtual Environment%%
venv\Scripts\activate
%%Deactivate the Virtual Environment%%
deactivate
To generate a requirements.txt file that lists all the packages installed in your virtual environment, you can use the following command
pip freeze > requirements.txt
A ".gitignore" file is highly recommended to exclude certain files and directories from being tracked by Git. This is useful to prevent sensitive information, temporary files, and unnecessary files from being pushed to your repository.
Save the .gitignore file.
Commit and push the .gitignore file to your repository. This will ensure that the files and directories listed in the .gitignore file are not tracked by Git.
# Ignore virtual environment
venv/
# Ignore compiled Python files
__pycache__/
# Ignore IDE specific files
.vscode/
.idea/
*.pyc
# Ignore sensitive information
secrets.json