1. 在pycharm切换python版本:


apply-->ok即可
2. chromedriver放置目录:
chromedriver文件放在“/usr/local/bin”目录下,然后运行下面代码不报错:
import selenium
from selenium import webdriver
driver = webdriver.Chrome()
chromedriver与chrome浏览器对照表参考:
https://blog.csdn.net/huilan_same/article/details/51896672

chromedriver的下载链接:
http://npm.taobao.org/mirrors/chromedriver/
另外,
anaconda下虚拟环境中的selenium放置目录
/Users/fujunmin/anaconda/envs/python36/lib/python3.6/site-packages/selenium/webdriver/chrome
3. 查看chromedriver版本
- 进入终端
- 输入cd /usr/bin
- 输入open . ,此时在finder中打开了 /usr/bin/
- 在finder中切换到目录 /usr/local/bin/下,然后找到chromedriver文件
- 5.然后把/usr/local/bin/目录下的chromedriver文件拖到terminal中,并回车
- terminal中显示出了chromedriver的版本号
如下:

注意:将chromedriver的版本和本地安装的chrome的版本对照,因为版本对应不正确的话,可能导致一些不可预知的错误。
4. 查看安装的selenium的版本号
进入/Users/xxxxxxxx/anaconda/envs/python36
pip show selenium
或者pip list ,在列出来的列表中找selenium的版本号,这个有点麻烦
网友评论