[問題] 請問用Python3.10安裝requests

看板Python作者 ( )時間2年前 (2021/12/23 18:32), 2年前編輯推噓2(202)
留言4則, 2人參與, 2年前最新討論串1/1
不好意思 之前用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

12/23 19:19, 2年前 , 1F
出錯的那行 把collections 改成 collections.abc
12/23 19:19, 1F
我其實沒有import collections 我也試過import collections.abc 但是結果一樣 ※ 編輯: adeniss (180.214.188.111 臺灣), 12/23/2021 19:35:31

12/23 19:45, 2年前 , 2F
from typing import Mapping
12/23 19:45, 2F

12/23 19:47, 2年前 , 3F
更新requests就可以解決了吧
12/23 19:47, 3F

12/23 19:48, 2年前 , 4F
最後我把urllib3跟request2移除後 先重新安裝urllib3到1.26.7版 再重新安裝request2到2.26版就行了 給大家參考 ※ 編輯: adeniss (180.214.188.111 臺灣), 12/23/2021 20:12:32
文章代碼(AID): #1Xn51Dz1 (Python)