python3爬虫环境搭建
安装python3
sudo apt-get install python3-dev build-essential libssl-dev libffi-dev libxml2 libxml2-dev libxslt1-dev zlib1g-dev
sudo apt-get install python3
sudo apt-get install ptyhon3-pip
ubuntu安装mongo
sudo apt-get install mongodb
mongod
mongo
> show dbs
admin (empty)
local 0.078GB
> use local
switched to db local
> db.test.insert({'a':'b'})
WriteResult({ "nInserted" : 1 })
mac安装mongo
brew install mongodb
brew services start mongodb
ubuntu安装redis
sudo apt-get install redis-server
redis-cli
127.0.0.1:6379> set 'a' 'b'
OK
127.0.0.1:6379> get 'a'
"b"
127.0.0.1:6379>
root@iZwz91u9ywulp6n78yyed6Z:~# sudo vi /etc/redis/redis.conf
requirepass myredisserver
sudo service redis restart
root@iZwz91u9ywulp6n78yyed6Z:~# redis-cli -a myredisserver
127.0.0.1:6379> get 'a'
"b"
127.0.0.1:6379>
mac 安装redis
brew install redis
qunzhudeMacBook-Air:/ qunzhupu$ brew services start redis
==> Successfully started `redis` (label: homebrew.mxcl.redis)
qunzhudeMacBook-Air:/ qunzhupu$ redis-cli
127.0.0.1:6379> set 'a' 'b'
OK
127.0.0.1:6379> get 'a'
"b"
cd /usr/local/etc
sudo vim redis.conf
requirepass foobared
ubuntu配置mysql
root@iZwz91u9ywulp6n78yyed6Z:~# cd /etc/mysql/
root@iZwz91u9ywulp6n78yyed6Z:/etc/mysql# ls
conf.d debian.cnf debian-start my.cnf my.cnf.fallback mysql.cnf mysql.conf.d
root@iZwz91u9ywulp6n78yyed6Z:/etc/mysql# cd mysql.conf.d/
root@iZwz91u9ywulp6n78yyed6Z:/etc/mysql/mysql.conf.d# ls
mysqld.cnf mysqld_safe_syslog.cnf
root@iZwz91u9ywulp6n78yyed6Z:/etc/mysql/mysql.conf.d# vi mysqld.cnf
root@iZwz91u9ywulp6n78yyed6Z:/etc/mysql/mysql.conf.d# sudo service mysql restart
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
FLUSH PRIVILEGES;
selenium库使用
>>> import selenium
>>> from selenium import webdriver
>>> driver - webdriver.Chrome()
>>> driver.get('http://www.baidu.com')
安装beautifulsoup4和pyquery
pip3 install beautifulsoup4
pip3 install pyquery
qunzhudeMacBook-Air:bin qunzhupu$ python3
Python 3.7.0 (default, Jun 29 2018, 20:13:13)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyquery import PyQuery as pq
>>> dec =pq('<html></html>')
>>> dec =pq('<html>Hello</html>')
>>> result = dec('html').text()
>>> result
'Hello'
>>>
pymysql连接Mysql
qunzhudeMacBook-Air:bin qunzhupu$ python3
Python 3.7.0 (default, Jun 29 2018, 20:13:13)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymysql
>>> conn = pymysql.connect(host='123.206.204.80',user='puqunzhu',password='123456',port=3306,db='puqunzhu')
>>> cursor = conn.cursor()
>>> cursor.execute('select * from article')
1
pymongo连接mongoDB
pip3 install pymongo
qunzhudeMacBook-Air:bin qunzhupu$ python3
Python 3.7.0 (default, Jun 29 2018, 20:13:13)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymongo
>>> client = pymongo.MongoClient('localhost')
>>> db = client['newtestdb']
>>> db['table'].insert({'name':'Bob'})
__main__:1: DeprecationWarning: insert is deprecated. Use insert_one or insert_many instead.
ObjectId('5bc5b059e18a3620cc46bdb4')
>>> db['table'].find_one({'name':'Bob'})
{'_id': ObjectId('5bc5b059e18a3620cc46bdb4'), 'name': 'Bob'}
redis连接redis
pip3 install redis
qunzhudeMacBook-Air:bin qunzhupu$ python3
Python 3.7.0 (default, Jun 29 2018, 20:13:13)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import redis
>>> r = redis.Redis('localhost',6379)
>>> r.set('name','puqunzhu')
True
>>> r.get('name')
b'puqunzhu'
flask代理获取
pip3 install flask
django
pip3 install django
jupyter
pip3 install jupyter
qunzhudeMacBook-Air:bin qunzhupu$ jupyter notebook
python3爬虫环境搭建的更多相关文章
- selenium+python爬虫环境搭建
前言: 准备使用selenium爬取网站数据,先搭建selenium+python爬虫环境搭建 系统环境: 64位win10系统,同时装python2.7和python3.6两个版本,IDE为pych ...
- Python基础之Windows下Python3.x环境搭建
本文介绍使用Python3.x搭建Python环境,文章最后将使用Windows自带的cmd写一个简单的Python程序. 下载Python环境安装包 在https:/www.python.org/下 ...
- python3之环境搭建以及基础语法
早些时候,有一段时间吧,为了想免费下载网易云的收费音乐,也是翻了下python的教程的,语法方面没细致地去看,跟java.php.javascript这些都大同小异,也是面向对象的.那么,近期准备快速 ...
- 云效(阿里云)流水线 + nginx + uWsgi + flask + python3 基础环境搭建 --备忘
一.开发环境搭建 1.安装python3 yum -y groupinstall "Development tools" yum -y install zlib-devel bzi ...
- Python3+selenium3环境搭建笔记
系统:win7 64位浏览器:ie9 64位 chrome70 32位 firefox63 64位python版本:3.6.5 Windows x86 executable installersele ...
- 2 Selenium3.0+Python3.6环境搭建
[说明] 再次搭建一次环境,是因为遇到怎么都打不开IE的问题了,环境信息为:Selenium3.0+Python3.6+win7+ie10 [搭建步骤] 1.下载Python3.6,并点击安装和配置环 ...
- 金玉良缘易配而木石前盟难得|M1 Mac os(Apple Silicon)天生一对Python3开发环境搭建(集成深度学习框架Tensorflow/Pytorch)
原文转载自「刘悦的技术博客」https://v3u.cn/a_id_189 笔者投入M1的怀抱已经有一段时间了,俗话说得好,但闻新人笑,不见旧人哭,Intel mac早已被束之高阁,而M1 mac已经 ...
- python——python3.6环境搭建(Windows10,64位)
1.python软件资源下载 1.1 打开python官网地址:https://www.python.org 1.2 根据自己电脑的设置选择下载合适的python3.6.2 1.3 此处选择windo ...
- vs2015 + Python3.5 环境搭建
1. vs2015只支持Python3.5及以前的版本,对应Anaconda3.4.2之前的版本. 2. 卸载掉所有安装过的Python 3. 建议重装VS2015, 因为增量升级Python Too ...
随机推荐
- linux部署html代码到linux服务器,并进行域名解析
本博客主要是说一下,如何将本地写好的html代码部署到linux服务器,并进行解析.下一篇博客将写一下,如何将html代码部署到阿里云服务器,并进行域名解析,以及在部署过程中遇到的问题和解决方法. 1 ...
- Protostuff序列化问题
最近在开发中遇到一个Protostuff序列化问题,在这记录一下问题的根源:分析一下Protostuff序列化和反序列化原理:以及怎么样避免改bug. 1. 问题描述 有一个push业务用到了mq,m ...
- Android中px dpi dip density densityDpi 的相关说明
转自:http://www.cnblogs.com/wader2011/archive/2011/11/29/2267490.html 概念解释 名词 解释 Px (Pixel像素) 不同设备显示效果 ...
- 【第十四篇】easyui datagrid导出excel
<a class="btn btn-app" onclick="exportExcel()"><i class="fa fa-edi ...
- 误删除系列一:linux的bin目录误删除后恢复操作
感言:一失足成千古恨,一不小心就把/usr/bin下所有的命令都删除了,当你以为自己很熟练时,当你以为自己操作对时,可能就是失手的时候,还好这次只是一个测试环境....God 恢复过程:(以下是在vs ...
- java架构之路-(12)JVM垃圾回收算法和垃圾回收器
接上次JVM虚拟机堆内存模型来继续说,上次我们主要说了什么时候可能把对象直接放在老年代,还有我们的可能性分析,提出GCroot根的概念.这次我们主要来说说垃圾回收所使用的的算法和我们的垃圾回收器,需要 ...
- java、八大经典书籍,你看过几本?
java.八大经典书籍,你看过几本? 转载 一.Java从入门到精通 <Java从入门到精通(第3版)>从初学者角度出发,通过通俗易懂的语言.丰富多彩的实例,详细介绍了使用Java语言进 ...
- 近日让很多人议论纷纭的P++,PHP新分支?
最近大家可能有看到一个新的名词——P++. 很巧这个词来源于不久前从 Zend 公司离职的 Zeev Suraski 以 PHP 开发组成员的身份提议要创建 PHP 方言,暂命名为 P++. 老兄最近 ...
- charles 启用/禁用断点
本文参考:charles 启用/禁用断点 1.3. enable/disable breakpoints 和 2.3 breakpoints settings 断点设置是常用的了,没啥好说的了,可以设 ...
- oracle 常用脚本以及语句
oracle 常用脚本以及语句 一.oracle 安装10G 单机初始化环境: #!/bin/bash #关闭selinuxsed -i 's\SELINUX=enforcing\SELINUX=di ...