Skip to content

Instantly share code, notes, and snippets.

@prod3v3loper
Last active June 15, 2024 04:01
Show Gist options
  • Save prod3v3loper/3be347af91e3eb4fb7fa23f899719c3c to your computer and use it in GitHub Desktop.
Save prod3v3loper/3be347af91e3eb4fb7fa23f899719c3c to your computer and use it in GitHub Desktop.

Best practice python

workspace/
├── .venv/
├── project1/
│   ├── main.py
├── project2/
│   ├── main.py
├── project3/
│   ├── main.py

List your packages

$ pip3 list

Create virtual environment

Go in your project folder

$ cd workspace

Create the virtual environment for python

$ python3 -m venv .venv

Activate virtual environment (On macOS and Linux)

$ source .venv/bin/activate

For Windows

$ .venv\Scripts\activate

Then extensions

Now install your python packages for your project. Safety first ;)

For python:

$ pip3 install pyinstaller requests

OR

$ pip3 install -r requirements.txt

List your packages in requirements.txt to install

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