LANGUAGE » PYTHON

Command

Usage

shell
python OPTIONS SCRIPT ARGUMENTS
OptionDescription
-cRun commands instead of a script.
-iRun the script (or commands) and enter in interactive mode.
-mRun module in sys.path instead of a script.

Create a virtual environment:

shell
python -m venv .venv

Troubleshooting

There are some environments (i.e. CI/CD) that fail to import local scripts when using commands installed by pip.

Add the PYTHONPATH environment variable to fix the issue:

shell
env PYTHONPATH=. alembic upgrade head