강의

멘토링

커뮤니티

Inflearn Community Q&A

kyueihan5904's profile image
kyueihan5904

asked

Introduction to Python and Creating Various Automated Applications Using Web Crawling

[ Quick Tip! ] Automate downloading YouTube videos and converting to MP3 using Python!

아래 코드를 실행했을때 ModuleNotFoundError: No module named 'pytube' 에러가 뜹니다.

Written on

·

787

1

from pytube import YouTube

yt = pytube.YouTube("https://www.youtube.com/watch?v=x6MeeKwt92E") #다운 받을 동영상 URL 지정
videos = yt.stream.all()

for i in range(len(videos)) :
    print(i, ',' , videos[i])


down_dir = "/Users/sophia/myworkspace/youtube"

videos[0].download(down_dir)
웹-크롤링python

Answer 2

0

import pytube

yt = pytube.YouTube("https://www.youtube.com/watch?v=WH7xsW5Os10") #다운받을 동영상 URL 지정

vids= yt.streams.all()

print('vids',vids)

에러가 

Traceback (most recent call last):
  File "C:\section2\youtube-downloader.py", line 1, in <module>
    import pytube
  File "C:\Users\FS15020201\Anaconda3\envs\section2\lib\site-packages\pytube\__init__.py", line 13, in <module>
    from pytube.streams import Stream
  File "C:\Users\FS15020201\Anaconda3\envs\section2\lib\site-packages\pytube\streams.py", line 62
    self.is_otf: bool = stream["is_otf"]
               ^
SyntaxError: invalid syntax



분명 pytube 가 설치되어 있습니다.
버전 10.7.2

0

niceman님의 프로필 이미지
niceman
Instructor

안녕하세요. 반갑습니다.

pytube가 정확하게 설치되지 않았거나, 가상환경에서 atom을 실행하지 않아서 

모듈을 찾지 못하는 경우입니다.

가상환경에서 pip list 또는 conda list 명령어로 pytube 설치 유무부터 확인해보세요!

kyueihan5904님의 프로필 이미지
kyueihan5904
Questioner

pytube는 정상적으로 설치가 되었습니다 ㅜㅜ

kyueihan5904's profile image
kyueihan5904

asked

Ask a question