搭建ubuntu+firefox+jupyter+python3+selenium的环境
来源:互联网 发布:centos pcre 下载 编辑:程序博客网 时间:2024/05/04 14:50
由于最近经常会有一些需要在网页上进行周期性处理的工作,所以就起了写个脚本来进行自动处理的念头。查了很多资料,最后发现python+selenium可以很好地满足我的需求。加上之前接触过jupyter notebook,觉得很好用。最后决定先搭建一套ubuntu+firefox+jupyter+python3+selenium的环境。
安装ubuntu
很简单,用VMware安装就行了。
安装openSSH
为了方便远程管理,需要安装SSH服务。
sudo apt updatesudo apt install -y openssh-server
安装最新版的Firefox
ubuntu自带的firefox是51版本的,selenium需要53以上的版本的版本,需要升级一下。
sudo apt -y install firefox
查看firefox版本
firefox --version
Mozilla Firefox 57.0
安装selenium
selenium只能通过pip安装,所以需要先安装pip
sudo apt -y install python3-pip
从清华镜像安装selenium
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple selenium
验证是否安装成功并查看版本
python3import seleniumhelp(selenium)
Help on package selenium:NAME seleniumDESCRIPTION # Licensed to the Software Freedom Conservancy (SFC) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The SFC licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License.PACKAGE CONTENTS common (package) webdriver (package)VERSION 3.7.0FILE /home/selenium/.local/lib/python3.5/site-packages/selenium/__init__.py
selenium安装成功后还要安装firefox驱动
驱动下载地址:https://github.com/mozilla/geckodriver/releases
下载完成后将驱动解压到/usr/bin
wget https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-linux64.tar.gztar -xzf ./geckodriver-v0.19.1-linux64.tar.gz sudo mv ./geckodriver /usr/bin/
测试selenium能否正常启动firefox
python3from selenium import webdrivertest = webdriver.Firefox()
安装jupyter notebook
同样需要使用pip安装
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple jupyter
配置jupyter notebook远程访问
生成配置文件
jupyter notebook --generate-config
设置密码
ipythonfrom notebook.auth import passwdpasswd()
把生成的密文‘sha:ce…’复制下来
Out[2]: 'sha1:e71cc9a18431:f65****eccd3****84***********'
修改默认配置文件
vi ./.jupyter/jupyter_notebook_config.py
c.NotebookApp.ip='*'c.NotebookApp.password = u'sha:ce...刚才复制的那个密文'c.NotebookApp.open_browser = Falsec.NotebookApp.port =6789便指定一个端口
启动jupyter notebook
jupyter notebook --allow-root
后台启动
nohup sudo jupyter notebook --allow-root
至此,ubuntu+firefox+jupyter+python3+selenium的环境搭建完成。在浏览器中输入http://ip:6789,即可访问jupyter
notebook。
阅读全文
0 0
- 搭建ubuntu+firefox+jupyter+python3+selenium的环境
- selenium 3+python3.6+firefox的Windows详细环境搭建
- 从零开始:Mac OS下搭建 python3+selenium+firefox+pycharm 环境
- selenium 3+python3.6+firefox的windows详细环境搭建以及小demo
- Python3+selenium环境搭建
- python3.5 + selenium环境搭建
- Python3.4 + selenium + Firefox 自动化测试环境!
- ubuntu python3 安装selenium及Firefox环境配置-亲自实验,没问题
- ubuntu python3 安装selenium及chrome的环境配置
- Selenium + Pycharm+python3.6自动化环境搭建
- selenium, firefox, python环境搭建指南
- 1、搭建python+selenium+firefox环境
- Jupyter云端python开发环境的搭建
- python3学习之环境搭建(ubuntu环境)
- ubuntu环境下搭建python3开发环境
- Selenium的运行环境不要使用python3
- 搭建python3.6+Selenium
- Ubuntu下搭建Robotframework+Selenium环境
- Ubuntu14 python3.5 visualvenv 中安装opencv3.1.0
- MATLAB硬币定位
- 对于有经验的程序员和经验丰富的程序员
- Java虚拟机整体理解
- 热浪,一道屡刷不爽的题目
- 搭建ubuntu+firefox+jupyter+python3+selenium的环境
- Stackoverflow--Can you explain the concept of streams?
- 阿里云服务器安装nodejs环境
- fq文件随机提取sys.argv[1]条reads python
- linux redis日常工作命令总结
- 蓝桥杯 算法提高 P0101(Java解题)
- 一些简单的小程序_4——C语言篇
- 有了服务器,域名,如何将静态网页放到服务器上,让所有人都能访看到?
- css中常见的问题