WoJo
WoJo

Reputation: 516

Use Youtube-dl in python script using import youtube_dl

I want to use youtube-dl in a python script, not using commands. I installed youtube-dl using pip install youtube-dl and I also tried installing it using pip install --upgrade youtube-dl and also pip3 install youtube-dl. It keeps saying I have it installed so I'm guessing the installation is fine.

When I try to use import youtube_dl it gives me the error: unresolved import 'youtube_dl'Python(unresolved-import)

Please help!

Upvotes: 0

Views: 1838

Answers (1)

Caleb Njiiri
Caleb Njiiri

Reputation: 1821

This is a VS Code issue and not a youtube-dl issue. What you need to do is

  1. Go into the workspace folder (here workspaceRootFolder) and create a .env file
  2. In this empty .env file add the line PYTHONPATH=codeFolder (replace codeFolder with your folder name)
  3. Add "python.envFile": "${workspaceFolder}/.env" to the settings.json
  4. Restart VS code

Upvotes: 1

Related Questions