Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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
Question marked as Best reply

Posted on Nov 18, 2021 8:29 AM

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


Similar questions

2 replies
Question marked as Best reply

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


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 ID.