I'm executing with pycharm the following:
print(os.environ["PATH"]) # returns '/usr/bin:/bin:/usr/sbin:/sbin'
But when I execute echo $PATH in a shell this is returned:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/opt/local/sbin
I tried to edit it in Preferences > Console > Python Console > Environment Variables, setting
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/opt/local/sbin
but this is not working
any idea?
On Ubuntu, using zsh, I stumbled upon the same problem.
The hack I use in order to have the same environment variables in PyCharm and my shell is to launch PyCharm from my terminal instead of using the icon. It looks like this way that the PyCharm shell inherits from the main shell it's been launched from.
I hope it can solve other people's problem as I wasn't able to replicate @Steve Tarver's solution on Linux (.../terminal/.zshrc was read only on /snap/, even when using sudo).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With