[問題] no module named、 cannt import name

看板Python作者 (RW)時間6年前 (2018/03/13 10:26), 編輯推噓0(0010)
留言10則, 2人參與, 6年前最新討論串1/1
各位前輩好,我剛開始學python想爬網頁資料,但在VS code 環境上一直有Error 請問可能是什麼問題? 環境 Windows 10、python 3.6.4 已於CMD pip install 下列 beautifulsoup4.cycler.matplotlib.numpy.pyparsing. python-dateutil.pytz.request.six 程式一:CMD可執行、VS code 報錯 no module named 'html.entities' https://imgur.com/d6oEodc
import requests url = '任意網址' response = requests.get(url) print(response.text) ------------------------------------------------------------------------- 程式二:CMD可執行、VS code 報錯 cannot import name 'BeautifulSoup' https://imgur.com/IHLHE2i
html_doc = """ 任意html碼 """ from bs4 import BeautifulSoup soup = BeautifulSoup(html_doc, 'html.parser') soup = soup.find_all('td',"") print(soup) -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 175.98.136.130 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1520908013.A.B7C.html

03/13 14:29, 6年前 , 1F
好像版上總是很多這類情況,系統安裝多套 python
03/13 14:29, 1F

03/13 14:32, 6年前 , 2F
請問另一套在哪 我以為我只有裝官方的Python
03/13 14:32, 2F

03/13 18:59, 6年前 , 3F
先確定是否安裝不同套的 python, 比方 python 官方的
03/13 18:59, 3F

03/13 19:00, 6年前 , 4F
是否安裝多重不同版號的版本,以及是否安裝了其他廠商
03/13 19:00, 4F

03/13 19:01, 6年前 , 5F
的 python, 像是 anaconda 這類有人整合提供的安裝包
03/13 19:01, 5F

03/13 19:01, 6年前 , 6F
若系統有安裝不同版本、來源的 python, 那安裝套件
03/13 19:01, 6F

03/13 19:02, 6年前 , 7F
得確認是呼叫到正確所屬的 pip 程式
03/13 19:02, 7F

03/13 19:02, 6年前 , 8F
另外先確定 vs code 用的 python 是只想哪個位置的
03/13 19:02, 8F

03/14 09:50, 6年前 , 9F
找到問題了,我自己北七把一支測試檔明名html.py
03/14 09:50, 9F

03/14 09:51, 6年前 , 10F
還是謝謝Kenduest的熱心提點
03/14 09:51, 10F
文章代碼(AID): #1QfpRjjy (Python)