看板 Python 關於我們 聯絡資訊
不好意思 之前用selenium寫完code後 看到大家有推薦request 想說玩一下 也用pip安裝完了 但是 在import時就發生問題 在import requests時就發生 Exception has occurred: ImportError cannot import name 'Mapping' from 'collections' (C:\Python\lib\collections\__init__.py) collections裡面也的確沒有mapping 試著去pip install collections也沒用 所以上來求救一下 不知道有沒有版友可以幫忙解惑 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 101.10.57.26 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1640255565.A.F41.html
cuteSquirrel: 出錯的那行 把collections 改成 collections.abc 12/23 19:19
我其實沒有import collections 我也試過import collections.abc 但是結果一樣 ※ 編輯: adeniss (180.214.188.111 臺灣), 12/23/2021 19:35:31
lycantrope: from typing import Mapping 12/23 19:45
lycantrope: 更新requests就可以解決了吧 12/23 19:47
lycantrope: https://github.com/psf/requests/issues/5901 12/23 19:48
最後我把urllib3跟request2移除後 先重新安裝urllib3到1.26.7版 再重新安裝request2到2.26版就行了 給大家參考 ※ 編輯: adeniss (180.214.188.111 臺灣), 12/23/2021 20:12:32