Calling Python from bash: Difference between revisions
Jump to navigation
Jump to search
Line 13: | Line 13: | ||
=Using the Interpreter from the a Virtual Environment= | =Using the Interpreter from the a Virtual Environment= | ||
<font color=darkkhaki> | |||
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: | 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: | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
$(dirname $0)/venv/bin/python ... | $(dirname $0)/venv/bin/python ... | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</font> |
Revision as of 21:42, 15 February 2022
Internal
Overview
Inline Python Code
python <<EOF
print('blah')
EOF
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 ...