ming
ming

Reputation: 445

I installed both python 2.7 and 3.5, but python 3.5 does not work well

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

Answers (3)

R.Shabtai
R.Shabtai

Reputation: 81

Remove the "PYTHONHOME" environmental variable. (This resolved my problem when installed python27 x86 and python36 x64)

Upvotes: 4

C. Ch-Ch
C. Ch-Ch

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

ajays20078
ajays20078

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

Related Questions