python3.6 出現(xiàn)ImportError: cannot import name 'BeautifulSoup' 錯誤 求助
from bs4 import BeautifulSoup
html_doc = """
<html><head><title>The Dormouse's story</title></head>
<p class="title"><b>The Dormouse's story</b></p>
<p class="story">Once upon a time there were three little sisters; and their names were
<a class="sister" id="link1">Elsie</a>,
<a class="sister" id="link2">Lacie</a> and
<a class="sister" id="link3">Tillie</a>;
and they lived at the bottom of a well.</p>
<p class="story">...</p>
"""
soup = BeautifulSoup(html_doc,"html.parser",from_encoding="utf-8")
print("獲取所有連接")
links =soup.find_all('a')
for link in links:
? ? ? ? print (link.name,link['href'],link.get_text())
2018-01-24
樓主,我研究了一個晚上,from bs4 import BeautifulSoup報錯No module named 'bs4'問題,琢磨了一個方法。
首先,我使用的IDE是PyCharm Python版本3.6,在file選項中選擇settings選項點進去
然后選擇Project Interpreter
雙擊pip點進去
搜索ps4點擊 ? 然后點擊Install Package等會即可
應(yīng)該有用,但是我也是才學(xué)沒多久,方法也是在網(wǎng)上還是群里面看大佬們看出來的,希望對樓主有幫助。
2019-05-22
C:\Users\lenovo\PycharmProjects\untitled\venv\Scripts\python.exe C:/Users/lenovo/PycharmProjects/untitled/beautifulsoup.py
Traceback (most recent call last):
? File "C:/Users/lenovo/PycharmProjects/untitled/beautifulsoup.py", line 1, in <module>
? ? from bs4 import beautifulsoup
ImportError: cannot import name 'beautifulsoup'
Process finished with exit code 1
應(yīng)如何處理?
2017-06-20
先確定是否安裝了BeautifulSoup