Calling Python from bash
Jump to navigation
Jump to search
Internal
Overview
Inline Python Code
Use bash here-doc:
python3 <<EOF
print('blah')
EOF
Also see:
Code in External Script
External Program
External Module
Using the Interpreter from the a Virtual Environment
If you want to use the interpreter from a specific virtual environment instead of the interpreter found in PATH, explicitly use the path to the binary from the virtual environment directory:
$(dirname $0)/venv/bin/python ...