I installed Python 3.5.1 on my Mac, alongside Python 2.7.10. When I run python --version, it returns Python 2.7.10, and when I run python3 --version, it returns Python 3.5.1, which should confirm that Python 3 correctly installed. However, whenever I try to run a command or file with python3 in Terminal, it gives me this error:
Fatal Python error: Py_Initialize: unable to load the file system codec File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/init.py", line 123 raise CodecRegistryError,\ ^ SyntaxError: invalid syntax
Current thread 0x00007fff72bb4000 (most recent call first): Abort trap: 6 Farshids-MacBook-Pro-2:mysite Sasha$ python3 Fatal Python error: Py_Initialize: unable to load the file system codec File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/init.py", line 123 raise CodecRegistryError,\ ^ SyntaxError: invalid syntax
Current thread 0x00007fff72bb4000 (most recent call first): Abort trap: 6
and also pops up with a message saying "Python quit unexpectedly." As you can see in the error, it mentions 2.7, which means that it was probably trying to run the code using 2.7.
How do I fix this? By the way, I installed Python 3 to follow a Django tutorial that does not work without Python 3, and I'm so knowledgeable about Python to be able to adjust.