2

I am very new to python, I have installed Python 3.6 on my Windows 10 machine ( and I believe it has version 2.7 installed ). The installation was ok but when I try to start up it gives me error as shown below

Fatal Python error: Py_Initialize: unable to load the file system codec
 File "C:\csvn\Python25\\lib\encodings\__init__.py", line 123
 raise CodecRegistryError,\
 ^
SyntaxError: invalid syntax
Current thread 0x00002c78 (most recent call first):

Please someone would help me to identify this error and how to fix it. Thank you so much in advance for any help.

asked Dec 7, 2017 at 11:04
2
  • The error you are getting is caused by importing a Python 2.5 version of encodings in Python 3.6. That comma in the raise statement that is causing the syntax error is valid in Python 2 but not in Python 3. You can even see the version number in the path mentioned in the message. Commented Dec 7, 2017 at 13:02
  • For a vanilla installation you should have neither PYTHONPATH nor PYTHONHOME set in your environment. In a command prompt, enter set PYTHON to confirm that neither is set. If you use PYTHONPATH to add custom library directories, it should never include Python's installation directory or standard library directories. Commented Dec 7, 2017 at 21:49

2 Answers 2

1

The error can be resolved by adding an environment variable "PYTHONPATH" which point to the installation location of Python.

Refer to the following link,

Py_Initialize fails - unable to load the file system codec

answered Dec 7, 2017 at 11:08
Sign up to request clarification or add additional context in comments.

1 Comment

No, this error is almost always caused by needlessly defining PYTHONHOME (which should only be set temporarily in particular embedding and non-standard distribution scenarios) or adding standard directories to PYTHONPATH. Don't compound a mistake with more mistakes.
0

It may be because you have different versions of Python installed, so when you try to use the newest installed, it may be use the old interpreter instead, to solve the problem you absolutely need to change the PYTHONPATH.

Changing PYTHONPATH in shell [closed]

answered Dec 7, 2017 at 11:12

2 Comments

Thanks for both answers, But I still confuse and can't find the file that I need to edit to change the PYTHONPATH could you please help me locate the file. Thanks in advance
I'm pretty much sure i answered your question already. Just follow the link i mentioned and you're done. Here you got another way to solve this. [link] (stackoverflow.com/questions/3701646/…)

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.