zoukankan      html  css  js  c++  java
  • 树莓派ZeroW 安装软件工具(数据远程采集)--Python2

    >> [目录] 数据远程采集 Step by Step


    树莓派型号:Zero W

    树莓派系统:Raspbian,2018-11-13-raspbian-stretch-lite.img

    Python版本:2.7.13

    待安装软件工具:

    pipPython 包管理工具,提供了对Python 包的查找、下载、安装、卸载的功能
    pyserialPython的串口通讯包
    python-psutilProcess and System Utilities。访问系统CPU,内存,磁盘,网络等;进程管理(判断进程是否存在、获取进程列表、获取进程详细信息);命令行工具的功能(ps,top,lsof,netstat,ifconfig, who,df,kill,free,nice,ionice,iostat,iotop,uptime,pidof,tty,taskset,pmap)
    ntpNetwork Time Protocol。提供时间同步服务
    oss2阿里云对象存储(oss)的Python工具包



    电脑和树莓派连接同一个无线网络,使用PuTTY登录SSH(Host Name:raspberrypi.local,Port:22,点击Open)。


    image


    输入用户名(默认:pi)和密码(默认:raspberry)

    image


    查看Python版本


    pi@raspberrypi:~ $ python --version

    image


    安装pip


    查看有没有安装pip,显示pip还没有装

    pi@raspberrypi:~ $ pip --version

    image


    下载安装脚本get-pip.py

    pi@raspberrypi:~ $ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

    image


    运行安装脚本get-pip.py

    pi@raspberrypi:~ $ sudo python get-pip.py

    上面默认是从国外的服务器下载相关软件包的,我们最好指定一个国内的软件包镜像源,下载速度会快很多。

    pi@raspberrypi:~ $ sudo python get-pip.py -i https://pypi.tuna.tsinghua.edu.cn/simple

    显示这个脚本下载安装了pip-20.0.2, setuptools-44.1.0, wheel-0.34.2这三个软件工具。

    image


    查看pip版本,显示正常,表示pip已经安装成功

    pi@raspberrypi:~ $ pip --version

    image


    安装pyserial


    用pip工具安装pyserial,指定国内的镜像源:

    pi@raspberrypi:~ $ sudo pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyserial

    image


    安装oss2


    用pip工具安装oss2,指定国内的镜像源:

    pi@raspberrypi:~ $ sudo pip install -i https://pypi.tuna.tsinghua.edu.cn/simple oss2

    image

    image


    安装python-psutil

    需要用到aptitude来安装python-psutil,这个工具在装系统的时候已经自动安装上了。

    如果没装的话先安装:

    pi@raspberrypi:~ $ sudo apt-get install aptitude

    查看aptitude的版本:

    pi@raspberrypi:~ $ python-dev --version

    image

    安装python-psutil

    pi@raspberrypi:~ $ sudo aptitude install python-psutil

    image


    安装ntp


    存储数据帧时需要加上时间戳,ntp服务可以让树莓派与网络时间保持同步。

    pi@raspberrypi:~ $ sudo apt-get install ntp

    image

    选择Y

    image

    pi@raspberrypi:~ $ sudo apt-get install ntpdate

    image

    查看当前时间,可以看到默认采用英国时间(BST, British Summer Time)

    pi@raspberrypi:~ $ date

    image

    配置时区

    pi@raspberrypi:~ $ sudo dpkg-reconfigure tzdata

    在弹出的配置窗口中选择Asia,回车

    image

    在下一页窗口中,选择Shanghai(按 S 键可以快速定位到S开头的城市),回车确认

    image

    显示配置结果,时间已经正常了

    image

    编辑ntp.conf文件

    pi@raspberrypi:~ $ sudo nano /etc/ntp.conf

    在这两句的后面增加增加国内的ntp服务器地址,保存退出

    # You do need to talk to an NTP server or two (or three).
    #server ntp.your-provider.example

    server ntp.fudan.edu.cn iburst perfer
    server time.asia.apple.com iburst
    server asia.pool.ntp.org iburst
    server ntp.nict.jp iburst
    server time.nist.gov iburst

    image

    重启ntp服务,并查看时间

    pi@raspberrypi:~ $ sudo /etc/init.d/ntp restart

    pi@raspberrypi:~ $ date

    image

  • 相关阅读:
    〖教程〗Ladon探测域名内网IP(只允许域名访问站点)
    Ladon枚举远程主机网卡信息(OXID定位多网卡主机)
    Ladon批量检测漏洞 SMBGhost CVE-2020-0796
    Ladon7.0扫描器简明教程/用法例子
    〖教程〗Ladon IIS站点密码读取
    〖教程〗Ladon连接WebShell一句话远程执行命令
    〖教程〗Ladon内网横向移动Wmiexec/psexec/atexec/psexec/webshell
    〖教程〗Winrm远程命令/WimrnCmd/端口复用后门/Windows密码爆破
    〖教程〗Ladon以指定用户权限运行程序或命令
    〖教程〗Ladon迷你WEB服务器/一键内网HTTP服务器
  • 原文地址:https://www.cnblogs.com/hotwater99/p/12737451.html
Copyright © 2011-2022 走看看