Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

intellij python global environment set fail

I set some environment variables in /etc/profile or .bashrc ,all can not be use in intellij with python when runtime. so I have to set those variables in in intellij in here bellow. idea set global environment variables for all projects

however, i run a script code like this :

import os
print os.environ['PYTHONUNBUFFERED'] # intellij auto set ,work fine
print os.environ['CUDA_HOME']` # i set , failed, key_error.

the output surprised me. they both be set in the same place and same format. but behave different.

anyone can explain? thanks.

like image 938
june shen Avatar asked Nov 25 '25 08:11

june shen


1 Answers

Setting environment variables in .bashrc make them relative to one user's session only.

And /etc/profile limit env variables to the shell.

Set your variables in : /etc/environment or /etc/security/pam_env.conf

See : http://www.linux-pam.org/Linux-PAM-html/sag-pam_env.html

like image 116
Loïc Avatar answered Nov 27 '25 21:11

Loïc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!