Calling Python from bash: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 10: Line 10:
EOF
EOF
</syntaxhighlight>
</syntaxhighlight>
Also see: {{Internal|Python_Language_Modularization#Python_Script|Python Script}}


=Code in External Script=
=Code in External Script=

Revision as of 23:42, 15 February 2022

Internal

Overview

Inline Python Code

  python3 <<EOF
print('blah')
EOF

Also see:

Python Script

Code in External Script

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 ...