import pytube
pytube.YouTube('https://www.youtube.com/watch?v=qxhMUbpm_XI').streams.first().download()
yt = pytube.YouTube('https://www.youtube.com/watch?v=qxhMUbpm_XI')
yt.streams
....filter(progressive=True, file_extension='mp4')
....order_by('resolution')
....desc()
....first()
....download()
``
in terminal
PSF: ew 编程\python> pip install pytube 默认为用户安装,因为普通站点包不可写 已满足要求: c:\users hmed ppdata\local\packages\pythonsoftwarefoundation.python.3.12_qbz5n2kfra8p0\localcache\local-packages\python312\site-packages 中的 pytube (15.0.0) PS F: ew 编程\python> python download_from_youtube C:\Users hmed\AppData\Local\Microsoft\WindowsApps\python.exe: 无法打开文件 'F: ewProgramming\python\download_from_youtube': [Errno 2] 没有这样的文件或目录 PS F: ew 编程\python>
this problem in every library i was downloading by pip install i don't know what i should do ??
您必须添加
.py
扩展名。像 python download_from_youtube.py
而不是 python download_from_youtube
一样运行它。