[Note] Anaconda & VScode has trouble with python import error
Introduction h2>
When I run python in the terminal, I get an error when importing the module. This time is the memorandum.
Environment h2>
mac:Big Sur
Editor: VScode
Python:3.8
Trouble content h2>
When I run a python file written in VScode in a terminal, I get angry because it's not such a module.
But it's imported numpy, so it's not without it! !! If you just google for it
Apparently, if the python used from the terminal and the python set in VScode are different, an import error will occur.
Solution h2>
At the terminal
pip show numpy
Type to see Location. In my case
anaconda3/lib/python3.8/site-packages
I was using python in anaconda3. However, specify / usr / bin / python3 with VScode
I was doing it, so I got an error. It was easy if I knew it.
Later talk h2>
A few days after resolving this issue, I got the same error again. This time, I'm wondering if the python used is the same, so I just google it again. As a result, it seems that the module version was old.
So
pip install -U numpy
It is solved by. You can use it for general purposes by changing numpy to the module name where the error occurs.
By the way
pip list -o
Then, the old version will be displayed in a list.