2

I have both versions on my PC because I'm working through different tutorials, (I'm still a noob). I've seen a couple of similar questions on here, but nothing specific to Powershell.

When I run python in Powershell it brings up 2.7, but how do I specify that I want Python 3? Are there other issues that I need to be aware of? For example when running scripts from notepad++?

6
  • Have you tried python3 ? Commented Aug 18, 2016 at 10:48
  • Thanks for getting back so quick. I tried that, but it comes back with an error. Commented Aug 18, 2016 at 10:52
  • 1
    Check your path variable and see what the python bin path order is. I bet your python 2.7 will be listed first. You can specify the full path to python.exe to make sure you are running the correct version, or change your system path environment variable. Commented Aug 18, 2016 at 10:58
  • Thanks, that sounds like it could be the trick. Are there any resources I could look at to help me do this? Commented Aug 18, 2016 at 11:01
  • Use #! python3 shebang? Run py -3? Commented Aug 18, 2016 at 11:20

2 Answers 2

5

The command "py" (if v2 is the default) or "py -2" should launch Python 2.7, "py -3" should launch Python 3. See here for the details.

I've found this post as well. It might be helpful.

This one will help you check the current version you are using, if you desire to change that see here.

Should you want to pop out of the shell.

Cheers and have fun with Python ;)

Sign up to request clarification or add additional context in comments.

Comments

0

You can install Python3 via Chocolatey, AFAIK it will bring python3 command into your realm. Do not forget to uninstall previously installed Python3 before it.

Also, you may try to create alias for Python3, see Microsoft doc.

1 Comment

Thanks, I was about to do that, but Chocolatey seems to no longer be trusted, so I'm hesitant. I'd like to create an alias, but unfortunately I can't figure out how to run Python 3 in the first place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.