Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I set sys.path for Python IDLE sessions?

I have tried adding a path to python path in .bashrc but this had no effect within IDLE when I tested it with using import sys and print(sys.path).

share|improve this question
up vote 2 down vote accepted

.bashrc is read when bash is launched. Starting IDLE directly does not launch bash. If you launch IDLE from a terminal running bash you will see that it will be present.

share|improve this answer
But I used source ~/.bashrc,didn't that matter? – Gnijuohz Apr 4 '12 at 2:04
Of course that matters. For the shell you run it in. – Ignacio Vazquez-Abrams Apr 4 '12 at 2:05
I don't quite understand.I thought when I used source ~/.bashrc,the pythonpath in the whole system would change...So you are saying even if I reboot,the path wouldn't output in IDLE if I wouldn't launch it from the shell? – Gnijuohz Apr 4 '12 at 2:10
If you reboot then yes, since bash is run as part of the login sequence. – Ignacio Vazquez-Abrams Apr 4 '12 at 2:11
Ehh,what's the different between being run when logining and being run as in source ~/.bashrc,not the same thing?! – Gnijuohz Apr 4 '12 at 2:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.