비주얼스튜디오 bs4 실행이 되질 않고있습니다.
비주얼스튜디오에서 작업을 실행코자 하면 아래 메시지가 뜨네요...
from bs4 import BeautifulSoup as bs
ModuleNotFoundError: No module named 'bs4'
해결방법이 있을까요 ㅠㅠ
bs4를 깔려고하면
이미 깔았다는거 같은데....
Requirement already satisfied: bs4 in c:\python38\lib\site-packages (0.0.1)
Requirement already satisfied: beautifulsoup4 in c:\python38\lib\site-packages (from bs4) (4.9.1)
Requirement already satisfied: soupsieve>1.2 in c:\python38\lib\site-packages (from beautifulsoup4->bs4) (2.0.1)
원코드 풀버전
from urllib.request import urlopen
from bs4 import BeautifulSoup as bs
from urllib.parse import quote_plus
baseUrl = 'https://search.naver.com/search.naver?where=image&sm=tab_jum&query='plusUrl = input('검색어를 입력하세요 : ')# 한글 검색 자동 변환url = baseUrl + quoteplus(plusUrl)html = urlopen(url)soup = bs(html, "html.parser")img = soup.findall(class='img')
n = 1for i in img: imgUrl = i['data-source'] with urlopen(imgUrl) as f: with open('./img/' + plusUrl + str(n)+'.jpg','wb') as h: # w - write b - binary img = f.read() h.write(img) n += 1print('다운로드 완료')
안녕하세요.
첨부해주신 원코드 윗줄에 아래와 같은 코드가 더 있지 않은지요?
import sys sys.path.append('c:\python38\lib\site-packages')없다면 위의 코드를 제일 위해 추가해 주세요.
파이선 환경 설정은 하신거겠죠?
감사합니다.