'Python3 Not Recognizing pytube or pytube3 module

I know this question may have been asked, I did some research, searched through numerous forums and still cannot find a solution. I installed pytube and pytube 3 using each of these commands (I use VS Code Studio as my IDE)

pip install pytube
pip install pytube3
pip3 install pytube
pip3 install pytube3

tried numerous versions of these and they all successfully download pytube however when i use the import code

import pytube

it always gives me and error message and says "ImportError: No module named pytube" even though i successfully downloaded it using pip and or pip3

How do I get python/ and or VS Code IDE to recognize pytube? This does not happen with any other module I have/ have installed in the past. Any help would be greatly appreciated!



Solution 1:[1]

Figured it out, to anyone else struggling with this make sure the environment you're in is the correct one, for some reason VS Code had me in python 2.7 when i switched it started working.

WHen you run it you might get a long list of errors with the cause being somethithing with the SSL Certificate just use this short code at the beginning of your program and everything should work

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

Solution 2:[2]

i had the same problem and what i did was that i made an venv folder in my project folder using this command in the VS Code terminal. python -m venv "the folder path" after that you can uninstall pytube and install it using a new terminal in VS Code (Terminal -> New Terminal) then install pytube using pip install pytube and it should work.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SpacedOutKID
Solution 2 bacro.exe