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= | ||
If you want to use the interpreter from a specific virtual environment instead of the interpreter found in PATH. | 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'> | |||
$(dirname $0)/venv/bin/python ... | |||
</syntaxhighlight> |
Revision as of 21:40, 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 ...