zoukankan      html  css  js  c++  java
  • 部署一个Python爬虫环境(三)-ubuntu版_桌面系统过渡篇

    第二篇里的系统或许有点问题,所以我会采用原版的桌面版和Server版做两次过渡。

    今天一直在听《寂寞沙洲冷》

    一,部署环境及安装包

    系统:Ubuntu 20.04.1 LTS

    1.系统自带的python或python3.7

    2.Python 包安装和管理工具pip

    3.代理/抓包工具Mitmproxy

    4.传输和存储数据工具protobuf

    二,操作:

    查看软件版本

    root1@ubuntu:~$ python3 --version
    Python 3.8.5
    root1@ubuntu:~$ pip --version
    
    Command 'pip' not found, but there are 18 similar ones.
    
    root1@ubuntu:~$ mitmproxy --version
    
    Command 'mitmproxy' not found, but can be installed with:
    
    sudo apt install mitmproxy

    1.Python

      这版还是有啥用啥吧,Python3.8.5(系统有些命令用的Python3.8.5,降级不可取,可以再安装个Python3.7.1)

    2.安装pip

    su root  #切换到root用户
    
    sudo apt update
    
    sudo apt install python3-pip

      结果:

    root@ubuntu:/# pip3 --version
    pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

    3.安装Mitmproxy 

    pip3 install mitmproxy
    #执行完显示的内容:
    Successfully installed Brotli-1.0.9 Jinja2-2.11.3 Werkzeug-1.0.1 asgiref-3.3.1 cffi-1.14.4
    cryptography-3.3.1 flask-1.1.2 h11-0.12.0 h2-4.0.0 hpack-4.0.0 hyperframe-6.0.0 itsdangerous-1.1.0
    kaitaistruct-0.9 ldap3-2.8.1 mitmproxy-6.0.2 msgpack-1.0.2 passlib-1.7.4 protobuf-3.14.0
    publicsuffix2-2.20191221 pyOpenSSL-20.0.1 pyasn1-0.4.8 pycparser-2.20 pyparsing-2.4.7
    pyperclip-1.8.1 ruamel.yaml-0.16.12 ruamel.yaml.clib-0.2.2 sortedcontainers-2.3.0
    tornado-6.1 urwid-2.1.2 wsproto-1.0.0 zstandard-0.14.1

      结果:

    root@ubuntu:/# mitmproxy --version
    Mitmproxy: 6.0.2
    Python:    3.8.5
    OpenSSL:   OpenSSL 1.1.1i  8 Dec 2020
    Platform:  Linux-5.8.0-41-generic-x86_64-with-glibc2.29 

    4.安装protobuf

    oot@ubuntu:/# pip3 install pyprotobuf
    Collecting pyprotobuf
    Downloading pyprotobuf-0.8.tar.gz (48 kB)
    |████████████████████████████████| 48 kB 55 kB/s
    Building wheels for collected packages: pyprotobuf
    Building wheel for pyprotobuf (setup.py) ... done
    Created wheel for pyprotobuf: filename=pyprotobuf-0.8-py3-none-any.whl size=35854 sha256=eff5ead4265f7a0348eb21ad951bcb03310717ce41ff197d4e89fd15a030aa72
    Stored in directory: /root/.cache/pip/wheels/2c/38/03/b28884e3f36df80df8068a4f69ac09868aa36a0066064532ce
    Successfully built pyprotobuf
    Installing collected packages: pyprotobuf
    Successfully installed pyprotobuf-0.8

      查看结果(python环境里使用 'import google.protobuf'):

    root@ubuntu:/# python3
    Python 3.8.5 (default, Jul 28 2020, 12:59:40)
    [GCC 9.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import google.protobuf
    >>>

      结果如上图说明成功。

    补充:

      版本统计:

        Ubuntu 20.04.1 LTS;

        Python 3.8.5;

        pip 20.0.2;

        Mitmproxy 6.0.2;

        pyprotobuf 0.8;

    365个夜晚,我希望做到两天更一篇博客。加油,小白!
  • 相关阅读:
    证书格式转换
    emq知识点
    emq共享订阅
    SpringBoot
    Android网络编程Socket长连接
    Android 网络通信框架Volley简介(Google IO 2013)
    Android中的5种数据存储方式
    Android
    android解析XML总结(SAX、Pull、Dom三种方式)
    乔迁新禧
  • 原文地址:https://www.cnblogs.com/qq2806933146xiaobai/p/14372270.html
Copyright © 2011-2022 走看看