When I run the AWS CLI command on my Mac, I started getting the command No module named'encodings'
. I'm writing a lot about what I did at this time.
However, to conclude first, I reinstalled __Python3 __ and fixed it.
When I execute the aws command, I get the following error and try various googles. As a side note, since we are using Python in the AWS CLI, Python must also be configured correctly.
$ aws configure --profile XXXX
...(abridgement)...
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
...(abridgement)...
I tried all the path related fixes.
--When I googled the error, a page saying that the path of PYTHONHOME was suspected appeared, so when I checked .bash_profile
, it was certainly not set. Therefore, I decided to set the default value / usr / local
.
--As a result, the error has changed, but I get another __syntax error` __...
--I tried setting various values in .bash_profile
in the same way, but even if the error changed, it could not be solved ...
On Mac, / usr / bin / python
is the Python2 version by default. Therefore, I installed Python3 using another tool such as pyenv or Anaconda, but at this time I did not change the path of Python3 from / usr / bin / python
. It seems that the path of Pyhton 3 has gone wrong while working on various things.
__ * It is thought that the cause was not pyenv or Anaconda, but the environment was destroyed during the work. __
After uninstalling pyenv and Andaconda, I reinstalled Python3 by referring to the following. [Python3] Summary of steps to install the latest version of Python on a clean Mac
In the above procedure, I added the Python3 path to / usr / bin / python
. You can now pass the aws command safely.
To be honest, I thought I should have reinstalled it from the beginning. I thought it would be troublesome to reset the interpreter in the IDE, but it's quite short compared to the time I was addicted to.
It's important to give up everything ...
Recommended Posts