最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【记录】Mac中用Python去模拟百度登陆

Mac crifan 197浏览 0评论
折腾:
【未解决】用Java实现百度模拟登陆
期间,发现java太麻烦。还是换用Python吧。
结果此处搭建pipenv环境又出了问题:
【已解决】pipenv install出错:TypeError: expected str, bytes or os.PathLike object, not NoneType
然后正常了:
但是安装库又出错了:
➜  EmulateBaiduLogin pipenv install requests
Installing requests...
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting requests
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ff/17/5cbb026005115301a8fb2f9b0e3e8d32313142fe8b617070e7baad20554f/requests-2.20.1-py2.py3-none-any.whl (57kB)
Collecting idna<2.8,>=2.5 (from requests)
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl (58kB)
Collecting urllib3<1.25,>=1.21.1 (from requests)
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl (118kB)
Collecting certifi>=2017.4.17 (from requests)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/56/9d/1d02dd80bc4cd955f98980f28c5ee2200e1209292d5f9e9cc8d030d18655/certifi-2018.10.15-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Installing collected packages: idna, urllib3, certifi, chardet, requests
Successfully installed certifi-2018.10.15 chardet-3.0.4 idna-2.7 requests-2.20.1 urllib3-1.24.1

Adding requests to Pipfile's [packages]...
Pipfile.lock (5b5554) out of date, updating to (ef768b)...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
n/site-packages/pipenv/utils.py", line 402, in resolve_deps
    req_dir=req_dir
  File "/Users/crifan/Library/Python/3.6/lib/python/site-packages/pipenv/utils.py", line 250, in actually_resolve_deps
    req = Requirement.from_line(dep)
  File "/Users/crifan/Library/Python/3.6/lib/python/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 704, in from_line
    line, extras = _strip_extras(line)
TypeError: 'module' object is not callable
然后参考之前的:
【已解决】pipenv安装失败:TypeError: ‘module’ object is not callable
去:
➜  EmulateBaiduLogin pipenv run pip install pip==18.0
Collecting pip==18.0
  Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
      Successfully uninstalled pip-18.1
Successfully installed pip-18.0
➜  EmulateBaiduLogin pipenv install requests
Installing requests...
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: requests in /Users/crifan/.local/share/virtualenvs/EmulateBaiduLogin-NWdfeAzC/lib/python3.6/site-packages (2.20.1)
Requirement already satisfied: certifi>=2017.4.17 in /Users/crifan/.local/share/virtualenvs/EmulateBaiduLogin-NWdfeAzC/lib/python3.6/site-packages (from requests) (2018.10.15)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /Users/crifan/.local/share/virtualenvs/EmulateBaiduLogin-NWdfeAzC/lib/python3.6/site-packages (from requests) (3.0.4)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /Users/crifan/.local/share/virtualenvs/EmulateBaiduLogin-NWdfeAzC/lib/python3.6/site-packages (from requests) (1.24.1)
Requirement already satisfied: idna<2.8,>=2.5 in /Users/crifan/.local/share/virtualenvs/EmulateBaiduLogin-NWdfeAzC/lib/python3.6/site-packages (from requests) (2.7)

Adding requests to Pipfile's [packages]...
Pipfile.lock (5b5554) out of date, updating to (ef768b)...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...

Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
404 Client Error: Not Found for url: https://pypi.tuna.tsinghua.edu.cn/packages/ff/17/5cbb026005115301a8fb2f9b0e3e8d32313142fe8b617070e7baad20554f/requests-2.20.1-py2.py3-none-any.whl

➜  EmulateBaiduLogin pipenv graph
requests==2.20.1
  - certifi [required: >=2017.4.17, installed: 2018.10.15]
  - chardet [required: >=3.0.2,<3.1.0, installed: 3.0.4]
  - idna [required: >=2.5,<2.8, installed: 2.7]
  - urllib3 [required: >=1.21.1,<1.25, installed: 1.24.1]
即可。
然后需要去:
【未解决】用Chrome调试网页中百度账号登录的逻辑

转载请注明:在路上 » 【记录】Mac中用Python去模拟百度登陆

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
88 queries in 0.124 seconds, using 20.54MB memory