Website
www.python.org
~/.local/lib
but by setting some environment variables it can be moved somewhere else (You can add the following line to your .bashrc file - but you should not):... export PYTHONUSERBASE=~/mypylibs export PYTHONPATH=$PYTHONUSERBASE:$PYTHONPATH ...
To install some packages you can now use the pip command:
pip install --user SomePackage
In case you want to continuously pipe the standard output of the terminal (STOUT) into a file then the output is buffered. When outputting to a terminal, STDOUT will be line-buffered or not buffered at all, so you'll see output after each \n
or for each character.
You can use the option -u
to prevent python from buffering the output stream.
python3 -u ${SCRIPT_FILE} > ${FILE_TO_WRITE}
Or set an environment variable PYTHONUNBUFFERED=1
, (this is what PyCharm uses)
PYTHONUNBUFFERED=1 python3 ${SCRIPT_FILE} > ${FILE_TO_WRITE}
When you always want to execute a python-script in unbuffered mode you can add it to the Shebang at the beginning of your script.
#!/usr/bin/env python3 -u
Completely unbuffered output can slow down your simulation (creates a lot system-calls).
0-buffering, equal to PYTHONUNBUFFERD or -u
:
stdbuf -o0 python3 ${SCRIPT_FILE} > ${FILE_TO_WRITE}
L-buffering; Linebuffer, a complete line is buffered (best)
stdbuf -oL python3 ${SCRIPT_FILE} > ${FILE_TO_WRITE}
If it is not necessary to see all output written immediately, you can use user-defined buffers:
K
Kilobyte, M
Gigabyte or even G
Gigabyte.