Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics (Retired) Ins & Outs String Concatenation

Running Python in Visual Studio interpreter

If I am writing code in Visual Studio and have Python 3.5 installed locally, how can I use Python 3.5 to execute a file?

[Mod: updated title -cf]

1 Answer

You didn't specify which version of Visual Studio you're using.

I've got a copy of VS 2013 on Windows 7, and there's a couple of options under Tools > Python Tools in the menu:

  • Python Environments (allows you to set the default environment/Python version)
  • Python 3.5 Interactive (runs a Python 3.5 interactive shell)
  • Python 2.7 Interactive (runs a Python 2.7 interactive shell)

Hope that helps!

Oh and to execute/run a Python script, just open it in VS, then either right click in the code editor part and select Start with Debugging (or obviously Start without Debugging if you don't want to debug the code), or, to run it in the interactive shell, you can select Tools > Python Tools > Execute File in Python Interactive in the menu.

Im on Windows 10 with the 2015 version. All good though, I cloned my disk and working in Ubuntu now

Thanks!