导入selenium

随笔

只能说是我导入selenium遇到的问题,解决的途径有限,供参考。

主要是今天想做一个淘宝秒杀脚本,涉及到selenium安装,搜索后网上给出的方法是

C:\Users\Administrator>cd Desktop\taobao\venv\Scripts
C:\Users\Administrator\Desktop\taobao\venv\Scripts>pip install selenium

cmd进入命令行
先进入项目文件的venv下的Scripts文件夹
输入 pip install selenium 开始安装
然后就遇到了这样的问题
直接懵逼第一反应重试

C:\Users\Administrator\Desktop\taobao\venv\Scripts>pip install selenium
Collecting selenium
  Downloading https://files.pythonhosted.org/packages/80/d6/4294f0b4bce4de0abf13e17190289f9d0613b0a44e5dd6a7f5ca98459853/selenium-3.141.0-py2.py3-none-any.whl (904kB)
    100% |████████████████████████████████| 911kB 37kB/s
Collecting urllib3 (from selenium)
  Could not find a version that satisfies the requirement urllib3 (from selenium) (from versions: )
No matching distribution found for urllib3 (from selenium)

然后百度那玩意urllib3被坑了,安装了一个urllib3还提示成功。

C:\Users\Administrator\Desktop\taobao\venv\Scripts>pip install urllib3
Collecting urllib3
  Downloading https://files.pythonhosted.org/packages/e8/74/6e4f91745020f967d09332bb2b8b9b10090957334692eb88ea4afe91b77f/urllib3-1.25.8-py2.py3-none-any.whl (125kB)
    100% |████████████████████████████████| 133kB 39kB/s
Installing collected packages: urllib3
Successfully installed urllib3-1.25.8

到pycharm里测试失败(因为根本安装的就不是selenium)

最后(解决方法)

其实很简单
就把pip后面加个3就好了——pip3 install selenium

结果展示
C:\Users\Administrator\Desktop\taobao\venv\Scripts>pip3 install selenium
Collecting selenium
  Using cached https://files.pythonhosted.org/packages/80/d6/4294f0b4bce4de0abf13e17190289f9d0613b0a44e5dd6a7f5ca98459853/selenium-3.141.0-py2.py3-none-any.whl
Requirement already satisfied: urllib3 in c:\users\administrator\desktop\taobao\venv\lib\site-packages (from selenium) (1.25.8)
Installing collected packages: selenium
Successfully installed selenium-3.141.0

最后到pycharm的控制台验证一遍

Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
>>>import selenium

不报错就说明安装成功!

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页