Why is PYTHONPATH empty and must be exported every terminal session?

Answered

Hi 😊

Using Mac OS - Big Sur, I have a PyCharm project that holds two source roots directories.
Whenever I try to:

echo $PYTHONPATH

It results empty and I must export it locally per session.
I am using zsh as my shell and in the PyCharm Settings > Pythob Console I have both of these checked: 

I really don't understand what is wrong and why the above does not add the source root's path to the PYTHONPATH automatically.

Thanks!

0
2 comments

Hi,

The directories marked as source roots are added to PYTHONPATH at runtime. It doesn't affect the terminal. 

For the terminal, you can modify environment variables in **Preferences | Tools | Terminal**.

0

Great!
Worked as I want it.
Thanks a lot Andrey Resler

0

Please sign in to leave a comment.