7

To be able to use idle with my virtualenv python, I created an idle script

#!/myvirtualenv/python from idlelib.PyShell import main if __name__ == '__main__': main() 

in the bin/ of my virtualenv but it complains about not being able to find Tkinter.

** IDLE can't import Tkinter. Your Python may not be configured for Tk. ** 

I checked and Tkinter can be imported in the regular python2.7.1 but I can't import Tkinter from my virtualenv python. How can I make Tkinter available to my virtualenv python ( I have to use no site-packages with the virtualenv for an other reason) Thanks

2 Answers 2

3

One simple solution is to copy the tcl folder from your original python installation to the virtual environment. For example, on my machine I did the following:

C:\> virtualenv t:\env\myenv C:\> xcopy c:\python27\tcl t:\env\myenv\tcl /e /i /k 
Sign up to request clarification or add additional context in comments.

Comments

1

I'm currently using IDLE in a few Virtual Environments but my script to start it up looks like below. This works for me whether I created my environment using --no-site-packages option or not. For some reason I had to put the full path to my virtual python in the header of the script.

#!/home/steve/virt_idle/bin/python from idlelib.PyShell import main if __name__ == '__main__': main() 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.