Python Forum

Full Version: Fatal Python error: Py_Initialize: unable to load the file system codec
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I am using the terminal on a OS X El Capitan. Recently I have used python to run some software until I got some error and started updating the python versions to 3.5... through brew.

Error:
Traceback (most recent call last): File "/Users/samsa2/python_scripts/DIAMOND_subsystems_analysis_counter.py", line 119, in <module> for line in db: File "/Users/miniconda3/lib/python3.5/codecs.py", line 321, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 3173: invalid start byte
And now every time I run or try to activate an environment I have the following error:

Error:
Fatal Python error: Py_Initialize: unable to load the file system codec Traceback (most recent call last): File “/Users/user1/miniconda3/lib/python3.5/encodings/init.py”, line 31, in <module> File “/Users/user1/miniconda3/lib/python3.5/codecs.py”, line 322, in <module> NameError: name ‘open’ is not defined
I suspect I have installed different versions of python and there are problems with the PATH environment variable
When running "which python"
Quote:/Users/user1/miniconda3/bin/python

And my echo $PATH seems to be this
Quote:/usr/local/share/python:/Users/ecg1g15/miniconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

1. What is the best way to make python work again?
2. Is there anyway I could uninstall all python versions and install the one I desire (ideally 2.7)?

Thanks in advance

E