0

I started writing code in python 2, but am now doing a course that runs with python 3, so I have both installed on my Windows computer. Python 2 is my default. Is there a way to launch python 3 from the command line if python 2 is my default? Thanks!

1
  • simply write python3 my_code.py, this will use python3 if properly installed Commented Mar 9, 2016 at 8:52

3 Answers 3

2

if you are using windows, add the Python3 folder to the PATH variable. And then rename the python.exe to python3.exe and then you can easily use it from command line.

Also you might observe that you will be having two IDLE editors, so you can select the one which uses version you want then run code as you usually do.

If you have linux then you already have python and python3 in the system,

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

Comments

1

This may be helpful for others encountering the same problem.

You can type: py -3

to launch python 3 if you have python 2 installed as your default.

Comments

0

Try: cd C:\Python34\ python.exe [path_to_you_script]

example: cd C:\Python34\ python.exe "C:\Python34\000\my_script.py"

Comments

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.