Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.