How Can I Set Pythonpath In Fish?
The following works in bash: ~$ echo $PYTHONPATH ~$ export PYTHONPATH=/path/to/test/folder ~$ echo $PYTHONPATH /path/to/test/folder ~$ python -m test_script hello w
Solution 1:
Setting the variable is not sufficient, you must export it too (as you do in bash). Exporting means that subprocesses (like the Python call) will get the value too.
From the fish documentation:
-x or --export causes the specified environment variable to be exported to child processes
So a direct equivalent to the bash directive would be:
~> set --export PYTHONPATH /path/to/test/folder
You could add --universal
or other arguments, but here the value is temporary, which matches the original bash example.
(Found answer via a similar question.)
Solution 2:
If you want to make the change permanent then you can add the following line
set -xg PYTHONPATH /path/to/test/folder $PYTHONPATH
to the bottom of ~/.fish/config.fish
Post a Comment for "How Can I Set Pythonpath In Fish?"