Pycharm environment different than command line Pycharm environment different than command line sqlite sqlite

Pycharm environment different than command line


.bash_profile is being read by bash (your command line interpreter) only.However if you want to preserve bash environment for PyCharm there is onetrue Linux way.

Run PyCharm from your command line (from bash).Thus environment variables will be inherited from bash to pycharm.Read $man environ for information on linux environment inheritance process.So all you need is just launch ${PATH_TO_PYCHARM}/bin/pycharm.sh from command line.Or create launcher which invokes bash for PyCharm launching.

Thats it ! Hope that works for you.


If you are using PyCharm version 2016.3 and have noticed that your PyCharm Terminal is no longer providing the same default environment as your MacOs Terminal environment, it is a bug that should be fixed in 2016.3.1 - whenever it releases. In the mean time, the following is a workaround that should 'default' all of your PyCharm projects back a more more MacOS-Terminal like PyCharm-Terminal:

Create a ~/.bashrc file with the following contents:source /etc/bashrcsource /etc/bashrc_Apple_Terminalsource ~/.bash_profile

This should setup your PyCharm Terminal (interactive bash session) and make it similar to the MacOS Terminal (login bash session). Once JetBrains patches and releases 2016.3.1, I recommend deleting this ~/.bashrc file. Hopefully this will get us all back to normal.


Another approach is to source your script setting environmental variables (for example .bash_profile) by adding a line . /path/to/script into PY_CHARM_INSTALL_DIR/bin/pycharm.sh.

After that you can run pycharm using quick-lunch or whatever and you variables will be there.