How to pass $PATH to an application?

When I runs: echo $PATH in terminal, it gives the right and complete path (/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin)

However, in Pycharm, os.environ['PATH'] just show the default part of path (/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:)

Why is this happening?

Thanks.

MacBook Pro (2020 and later)

Posted on Nov 18, 2021 3:52 AM

Reply

Similar questions

2 replies

Nov 18, 2021 8:29 AM in response to SoonPrinceton

I suppose that whatever shell you use is setting up your PATH for you when it starts - for example in .zshrc or .bash_profile.

Your application of course does not see that.


I don't have Pycharm, but I think you can set the PATH that it uses, somewhere in the application preferences.

An alternative is to set the PATH in a more system-wide fashion.

BE CAREFUL - just add appropriate lines to this file


sudo vi /etc/paths


and add a first line to the file, containing


/Library/Frameworks/Python.framework/Versions/3.10/bin


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to pass $PATH to an application?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.