I set PYTHONPATH variable on my Apple laptop a while ago. I have checked /private/etc/profile config file. It is not there. Where else I could find it?
What other config file could be used to set the PYTHONPATH variable on OS X?
There are several config files that can be used to set PYTHONPATH in OS X:
The first is profile file which is located in hidden /private/etc/ folder:
/private/etc/profile
You can use the following syntax to set the variable there:
export MY_CUSTOM_ENV_VARIABLE="/Applications/MyApp/bin"
Other config files are .cshrc, .bashrc and . bash_profile which (thanks albert for your info) are located in user's home directory and based on your OS X might or might not be there:
/Users/username/.cshrc
/Users/username/.bashrc
/Users/username/.bash_profile
To set the environment variable in .cshrc file use the syntax below:
setenv MY_CUSTOM_ENV_VARIABLE /Applications/MyApp/bin
To set the environment variable using .bash_profile file use this syntax:
export MY_CUSTOM_ENV_VARIABLE=/Applications/MyApp/bin:$MY_CUSTOM_ENV_VARIABLE
In my case PYTHONPATH variable was set in .bash_profile file. And it was set with the following syntax:
export PYTHONPATH=/Users/myModules:$PYTHONPATH
whereis pythonin your console?.bashrcand/or your.bash_profilewhere theexport PATHmight be set up manually. In addition, you can check the path of Python by usingwhich python.