Multiple Python Version Support


Hey all, I’m just wondering if there is a way to easily switch between Python versions i.e. Python 2.x and 3.x
inside of Atom. I ask because while Atom is using the 3.x version on my computer, there are a few frameworks like Scapy and Scrapy that use 2.x. So for example I’d have one project using 3.x but then I’d like to create a new project using 2.x modules. Now, I have the 3.x Python version in my PATH, but would a solution be to also put the 2.x Python in it as well, or will it cause errors? Or is there a better solution? Thanks.


Atom itself does not support executing code, so you must be using a package to run Python. Which one are you using?


I’m using runner, although I also have Script.


Runner and Script both detect shebangs, so you can put a line at the beginning of your script with #!/path/to/executable to tell specific scripts to look for Python 2. Script also supports setting up profiles with defined command names.


Ohhh ok that’s actually great. Now is that the same in Windows or just for Linux?


Never mind it works on Windows as well. THANK YOU! This was an immensely useful and easy explanation.


It’s not exactly the same. On Linux, the shell can evaluate shebangs, whereas Windows doesn’t use them by default. However, both of those packages do. If you add a Windows shebang to a Python script, it won’t work on Unix due to the different path (so you’d have to specify the command yourself), but on Unix with a Unix path, both packages and the shell will function identically.

Unless you’re moving scripts between OSes regularly, you shouldn’t have to think about it most of the time.