I would like to have the environment variables i defined in my .bashrc to be loaded in python 2.7 IDLE on starting it from the ubuntu launcher.
These environment variables are loaded correctly when i start IDLE from the command line.
One solution http://ubuntuforums.org/showthread.php?t=253555&p=1484153#post1484153 modifies the /usr/bin/idle-python2.7 to include an environment variable at idle startup.
I am not sure how to do this for all environment variables without having to parse the .bashrc file in python.
Specifically, i want to export a variable in my .bashrc
export FOO="BAR"
and i wish to open idle-python2.7 from the ubuntu launcher and type:
>>> import os
>>> print os.environ['FOO']
BAR
Software Details:
OS: Ubuntu 12.04 64 bit
python version: 2.7
Please let me know if you require additional information from my part.
Two ideas from the manual .
Change the ubuntu launcher to run idle.py -s
and set an environment variable IDLESTARTUP
pointing to a file containing python commands to set your env.
Create an .Idle.py
in ~/
file that does the same thing (but triggered by Tkinter
)
Neither of those will execute .bashrc
so another idea
.bashrc
and then fires up IDLE
and my favourite
ipython
or regular python
from the shell, IDLE
isn't that great :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.