安装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爬虫环境搭建的更多相关文章

  1. selenium+python爬虫环境搭建

    前言: 准备使用selenium爬取网站数据,先搭建selenium+python爬虫环境搭建 系统环境: 64位win10系统,同时装python2.7和python3.6两个版本,IDE为pych ...

  2. Python基础之Windows下Python3.x环境搭建

    本文介绍使用Python3.x搭建Python环境,文章最后将使用Windows自带的cmd写一个简单的Python程序. 下载Python环境安装包 在https:/www.python.org/下 ...

  3. python3之环境搭建以及基础语法

    早些时候,有一段时间吧,为了想免费下载网易云的收费音乐,也是翻了下python的教程的,语法方面没细致地去看,跟java.php.javascript这些都大同小异,也是面向对象的.那么,近期准备快速 ...

  4. 云效(阿里云)流水线 + nginx + uWsgi + flask + python3 基础环境搭建 --备忘

    一.开发环境搭建 1.安装python3 yum -y groupinstall "Development tools" yum -y install zlib-devel bzi ...

  5. Python3+selenium3环境搭建笔记

    系统:win7 64位浏览器:ie9 64位 chrome70 32位 firefox63 64位python版本:3.6.5 Windows x86 executable installersele ...

  6. 2 Selenium3.0+Python3.6环境搭建

    [说明] 再次搭建一次环境,是因为遇到怎么都打不开IE的问题了,环境信息为:Selenium3.0+Python3.6+win7+ie10 [搭建步骤] 1.下载Python3.6,并点击安装和配置环 ...

  7. 金玉良缘易配而木石前盟难得|M1 Mac os(Apple Silicon)天生一对Python3开发环境搭建(集成深度学习框架Tensorflow/Pytorch)

    原文转载自「刘悦的技术博客」https://v3u.cn/a_id_189 笔者投入M1的怀抱已经有一段时间了,俗话说得好,但闻新人笑,不见旧人哭,Intel mac早已被束之高阁,而M1 mac已经 ...

  8. python——python3.6环境搭建(Windows10,64位)

    1.python软件资源下载 1.1 打开python官网地址:https://www.python.org 1.2 根据自己电脑的设置选择下载合适的python3.6.2 1.3 此处选择windo ...

  9. vs2015 + Python3.5 环境搭建

    1. vs2015只支持Python3.5及以前的版本,对应Anaconda3.4.2之前的版本. 2. 卸载掉所有安装过的Python 3. 建议重装VS2015, 因为增量升级Python Too ...

随机推荐

  1. Kubernetes --- 详细介绍和架构详解

    Kubernetes是一个跨主机集群的开源的容器调度平台,它可以自动化应用容器的部署,扩展和操作,提供以容器为中心的基础架构 目录 一. Kubernetes用途 二. Kubernetes特点 三. ...

  2. java.util.Timer简介

    Timer是用于管理在后台执行的延迟任务或周期性任务,其中的任务使用java.util.TimerTask表示.任务的执行方式有两种: 按固定速率执行:即scheduleAtFixedRate的两个重 ...

  3. centos php7 安装mysqli扩展心得

    在新配服务器时发现,php无法连接到mysql.通过phpinfo发现.根本没有显示mysqli的相关配置.经过一系列研究.总结了下.: 第一步: 在phpinfo里没有mysqli配置,原因是安装p ...

  4. ansible-playbook流程控制-loops循环使用

    1. ansible-playbook流程控制-loops循环使用    有时你想要多次重复任务.在计算机编程中,这称为循环.common ansible循环包括使用文件模块更改多个文件和/或目录的所 ...

  5. ES6新增常见特性

    一:声明属性let const var let const 区别 1.var声明变量会发生变量提升,let.const不会发生变量提升 2.var允许重复声明变量,let不可以 3.const声明变量 ...

  6. Day20 磁盘管理2之RAID卡

    1.磁盘的基本分区Gdisk 前面我们已经了解到fdisk分区,但fdisk不支持给高于2TB的磁盘进行分区.如果有单块盘高于2TB,建议使用Gdisk进行分区. 1.使用gdisk进行磁盘分区 1. ...

  7. oracle 11g 下载安装 使用记录

    Oracle 11g 使用记录 1.下载oracle快捷安装版:   (1)下载连接:https://pan.baidu.com/s/1ClC0hQepmTw2lSJ2ODtL7g 无提取码 (2)去 ...

  8. 略学扩展Eculid算法

    扩展 Euclid 算法 Euclid 算法 辗转相除法 计算两个数最大公因数 \(\text{gcd}(a,\,b) = \text{gcd}(b,\,a\%b)\) exEuclid 算法 裴蜀定 ...

  9. Linux环境下实现对文件读写操作

    ---- 今天分享一下在linux系统在实现对文件读写一些基本的操作,在这之前我们要掌握一些基本的技能在Linux环境下.比如查看命令和一个函数的具体用法,就是相当于查手册,在Linux下有一个man ...

  10. Flask基础(08)-->错误捕获(异常捕获)

    错误捕获(异常捕获) from flask import Flask from flask import abort app = Flask(__name__) @app.route('/demo1' ...