I have a package that I installed from a virtual environment. If I just launch the python interpreter, that package can be imported just fine. However, if I launch Idle, that package cannot be imported (since it's only available in one particular virtualenv and not global). How can I launch Idle from a virtualenv, so that all packages from the virtualenv would be available?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
On Windows, a Python script run from command line like this
some_script.py
might be run by other Python interpreter than the one used when usingpython some_script.py
command (it depends onpy
files association). If one wants to avoid this problem it's best to create a batch fileidle.bat
with the contentpython -c "from idlelib.PyShell import main; main()"
and place it in theScripts
folder in the virtualenv. Also, like others noted idle needs bothtcl
andtk
folders to work. The simplest solution is to create symbolic links from virtualenv to the base Python installation like this@biomed I am on Windows and I was trying this. In my python2.6 folder I had to copy the python26/tcl/tcl8.5 and python/tcl/tk8.5 folders to python26/Lib and then I created the script above in my virtualenv's scripts folder. Worked great.