Reputation: 445
In terminal, I can run py -2
successfully.
Nevertheless,
C:\Users\user>py -3
Fatal Python error: Py_Initialize: unable to load the file system codec
File "C:\Python27\lib\encodings\__init__.py", line 123
raise CodecRegistryError,\
^
SyntaxError: invalid syntax
Current thread 0x00004570 (most recent call first):
Upvotes: 8
Views: 2066
Reputation: 81
Remove the "PYTHONHOME" environmental variable. (This resolved my problem when installed python27 x86 and python36 x64)
Upvotes: 4
Reputation: 1
I used to have the same problem. I found that my python 2.7 is x86 and my python 3.5 is x64, so I deleted both of python 2 and 3, then reinstall python 2.7 and 3.5 as x64, then it works.
My install applications are shown in picture
Upvotes: 0
Reputation: 368
You can try setting python path.
C:\Users\user>set PATH=C:\Program Files\Python 3.5;%PATH%
C:\Users\user>set PYTHONPATH=%PYTHONPATH%;C:\python_lib_path
C:\Users\user>python
Upvotes: 1