简体   繁体   中英

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):

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM