How to launch python Idle from a virtual environment (virtualenv)

By: summonagus ● at Sept. 2, 2017, 5:29 a.m. ● and modified at Sept. 2, 2017, 5:30 a.m.
Posted under: #Tricks, #Solution, #Problem ● Your ip address: 23.20.129.162 ● views: 47 times.

AD Space Available, Book Now!

Question from: Khnle - Kevin

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?


Answered from: 9000

IDLE is essentially

from idlelib.PyShell import main

if __name__ == '__main__':
    main()

So you can launch it yourself unless you built the virtualenv without default packages.

Source: https://stackoverflow.com/q/4924068/6396981

Author

summonagus

Python Developer, Linux Enthusiast, and Senior writer at python.web.id
Website: https://github.com/agusmakmun
blog comments powered by Disqus