I have a problem with VS Code. I think the problem ir related to the environment of the code.
Im trying to import the psycopg2 pool method (from psycopg2 import pool
) after installing it with pip install psycopg2
, and it says that ModuleNotFoundError: No module named 'psycopg2'
How can I fix it?
CodePudding user response:
Press Ctrl shift p
, type Python: Select Interpreter
and choose the correct environment if it is an environment issue.
CodePudding user response:
The packages installed in the python environment you have selected can work.
You can through pip show psycopg2
to know where have you installed the psycopg2.To know which python interpreter you have selected from the bottom-left on the VSCode.
And after you switch the python interpreter, remember to renew a terminal(shortcut Ctrl Shift `), the python extension will activate this python environment in the terminal, then the packages can be installed in the right place.