Options

Switching between version of Python on Windows 7 OS?

ande0255ande0255 Banned Posts: 1,178
I'm currently taking a Udemy course for Basic to Advanced Python that I wanted to go through before touching Kirk Byers material, however I am having a hell of a time finding information on switching back and forth between versions for the course, has some expressions will be understood on Python 2.x while 3.x will not recognize it.

For example, very easy script, starting with opening notepad from the command prompt directory that I am saving python work in:

print ("Hello,", end='')
print (" world!")

When I run the .py file from the command prompt, I always get a carrot under the = of end='', saying it is not recognized or something.

I thought this may be because it was showing my current version of Python as 3.5.1 (I am guessing per the PATH system environmental variable), so I adjusted the PATH to my python projects folder;python27 for the version folder - This made it change to Python 2.7.3 when I type 'python' on the command line.

So I get the exact same error, and I do believe one of these versions should understand the end='' expression.

Wondering if it may be best to run these in workstation on two seperate VM's (if trying to run 2 versions on one Windows 7 machine is a huge pain), or if there is something I am missing to switch between which versions are running the .py file that I am missing?

Any help would be appreciated, I've scowered stackoverflow.com to actually fix several issues already, but cannot find an answer on there to this mysery :\

Comments

  • Options
    kohr-ahkohr-ah Member Posts: 1,277
    Easiest way is Google learn python the hard way. Go to the free online book. Run the powershell script that you can point it to the 2.7 folder.

    Or use a shell like PyCharm where you can easily select the version to run that session on.
Sign In or Register to comment.