Python Libraries can't be detected

Question:

I installed some python libraries, but they can’t be detected. In pycharm they are orange so excluted and Visual Studio Code says "Import "cv2" could not be resolved" if I want to include open cv. I also had 3 Versions of Python at first, but now I only have one left is that a problem?

Deleted old Versions of Python and Anaconda was the only thing that made the pip comand work again.
I looked up if everything is installed with "pip list".

Asked By: Marcus

||

Answers:

You need to have the installed python in your path. The first interpreter it reaches in path will be used, if not just add it to your path

where.exe python
C:distvenvstrk-fullstack-testScriptspython.exe
C:distPython310python.exe
C:UsersmobjAppDataLocalMicrosoftWindowsAppspython.exe

$ENV:PATH = "C:distPython310;$ENV:PATH"

where.exe python
C:distPython310python.exe
C:distvenvstrk-fullstack-testScriptspython.exe
C:UsersmobjAppDataLocalMicrosoftWindowsAppspython.exe

All modules installed with pip will follow the python interpreter used.

Recommend taking a look a https://docs.python.org/3/library/venv.html
to see how virtual environments are handled.

Answered By: MortenB

I think its not the version of Python. When you install Python you can choose advanced options and enable library installing.

Answered By: Alex Zhao
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.