A screenshot of my visual studio code is above in the link ^.
I have a virtual env running in the terminal in vsc. I have the vsc python interpreter set to python 3.10.7. I have been using pip to install dependencies. All other dependencies work, ie flask, tensorflow, numpy, etc. But youtube_dl says it cannot be resolved. It is installed in the location shown: c:usersuseronedrivedesktopprojectName.venvlibsite-packages
Any idea why this is not resolving?
I have tried doing pip install youtube_dl within the virtual env. I have tried it without of the virtual env, I have tried using python3 -m pip install youtube_dl. Not sure why this won’t resolve.
2
Answers
Please note that Python 3.10.7 in the lower right corner is not consistent with the python version you understand.
It is Python Interpreter instead of python version.
This problem is caused by the wrong python interpreter. You installed the package in the
.venv
environment and run the file at the base environment.The solution is using shorcuts "Ctrl+Shift+P" and typing "Python: Select Interpreter" to choose your
.venv
environment. (You can also click Python 3.10.7 in the lower right corner).You Can click on the "3.10.7 64-bit" and vscode will show you selected python environment and then make sure that the chose env is your ‘.venv’.
You can also run you code on terminal with activated .venv and there should not be a Problem.