1

When I try to run python 3 I get this error:

C:\Users\owner>python
File "C:\Python33\lib\site.py", line 173
file=sys.stderr)
    ^
SyntaxError: invalid syntax

I have never edited the site.py file.

I was running python 2 before, but I want to use python 3 so I edited the System Variables:

 C:\Users\owner\AppData\Roaming\cabal\bin;C:\Ruby193\bin;C:\Program Files (x86)\Google\google_appengine\;C:\ProgramData\chocolatey\bin;C:\Python33;C:\Python33\Scripts;

when I edit them back to use python 2 it works fine:

C:\Users\owner\AppData\Roaming\cabal\bin;C:\Ruby193\bin;C:\Program Files (x86)\Google\google_appengine\;C:\ProgramData\chocolatey\bin;C:\Python27;C:\Python27\Scripts;
user2803555
  • 161
  • 2
  • 2
  • 10

1 Answers1

2

In addition to changing PATH, also change PYTHONPATH and PYTHONHOME. See, e.g., this. For example:

set PYTHONHOME=C:\Python33
set PYTHONPATH=C:\Python33\lib

(thanks to aflat, this answer).

Edit:

  1. Confirm that you are setting the PATH so that it will take effect. See Step 2 of this.

  2. At the command prompt, run path and confirm it lists Python33 and not Python27.

Community
  • 1
  • 1
cxw
  • 16,685
  • 2
  • 45
  • 81