
python 新手,尝试 pip install curl_cffi ,报错:
Could not find a version that satisfies the requirement curl_cffi (from versions: ) No matching distribution found for curl_cffi python --version 显示:Python 2.7.17
然后尝试 pip3 install curl_cffi ,安装成功了,然后运行 test.py:
from curl_cffi import requests r = requests.get("https://tls.browserleaks.com/json", impersOnate="chrome101") print(r.json()) python3 test.py 报错如下:
Traceback (most recent call last): File "test.py", line 1, in <module> from curl_cffi import requests ImportError: cannot import name 'requests' python3 --version 显示:Python 3.6.9
请问这该怎么解决?
1 FkingMan 2024 年 5 月 8 日 pip3 安装,确认好你的 python 解释器版本。建议安装 pyenv 管理解释器版本 |
2 triangle111 2024 年 5 月 8 日 python 版本太低了,用 python3.8 以上版本再试一下 |
3 linxiaojialin 2024 年 5 月 8 日 用这个真的能防盾吗?交流一下 |
4 vaporemix 2024 年 5 月 8 日 @linxiaojialin 只能说过不了再想别的法子 |
5 Vegetable 2024 年 5 月 8 日 你用的 py3.6,pip 安装的这个包可能是非常旧的 0.1.5 版本,这个版本并没有你想要的 requests |
6 linxiaojialin 2024 年 5 月 8 日 @vaporemix 有试过几种盾,感觉其实它们并不在意指纹,更多的是看 UserAgent 和请求频率,用原生的 requests 和 curl_cffi 效果是一样的。甚至 curl_cffi 还缺少一些功能。 请教一下,你有试过哪种盾,用原生的 requests 会触发,用 curl_cffi 不触发吗? |
7 linxiaojialin 2024 年 5 月 8 日 @kisshere 解决了吗?这个好像只能在 Python 3.8~3.10 之间安装,建议用 3.9 。版本太低装不了,太高好像跟其它拓展有冲突。 |
8 qq78660651 2024 年 5 月 8 日 @linxiaojialin #3 https://pypi.org/project/tls-client/ 这个原理应该类似吧,昨天看到的,能过盾 |
9 qq78660651 2024 年 5 月 8 日 @qq78660651 测试网站 aHR0cHM6Ly9qYWJsZS50di8=; 刚好是你说的这种例子用 requests 能触发盾,但是用这个 tls-client 不会触发; |
10 linxiaojialin 2024 年 5 月 8 日 @qq78660651 感谢,我试试看 |
11 awsl2333 2024 年 5 月 9 日 via Android pip 和 python 的对应很乱,尤其是存在多个版本或者使用虚拟环境的时候,建议全部使用 python3 -m pip 的方式,此处 python3 可以是绝对路径或者相对路径 |
12 julyclyde 2024 年 5 月 13 日 我去看了一下文档才明白原来 curl_cffi 提供了和 requests 一样的接口 |