Yeelink初步体验
环境
概述
正文
$ls
HISTORY.rst NOTICE requests/ setup.cfg
LICENSE PKG-INFO requests.egg-info/ setup.py*
MANIFEST.in README.rst requirements.txt test_requests.py*
其中的requests既可以用于Python2也可以用于Python3,然后将这个requests目录拷贝到对应Python的site-packages下面。
- 编译zlib:
#!/bin/bash export CC=arm-none-linux-gnueabi-gcc ../zlib-1.2./configure \
--prefix=`pwd`
修改Makefile,修改AR和RANLIB如下:
AR=arm-none-linux-gnueabi-ar
RANLIB=arm-none-linux-gnueabi-ranlib
- 编译Python3:
#!/bin/bash ../Python-3.6./configure \
--host=arm-none-linux-gnueabi \
--build=armv7 \
--prefix=`pwd` \
--enable-ipv6 \
--enable-shared \
ac_cv_file__dev_ptmx="yes" \
ac_cv_file__dev_ptc="no" \
LDFLAGS="-L/home/pengdonglin/disk_ext/Third_Part/SQlite3/aarch32/lib \
-L/home/pengdonglin/disk_ext/Third_Part/Readline/aarch32/lib \
-L/home/pengdonglin/disk_ext/Third_Part/Termcap/aarch32/lib \
-L/home/pengdonglin/disk_ext/Third_Part/Zlib/aarch32/lib"\
CPPFLAGS="-I/home/pengdonglin/disk_ext/Third_Part/SQlite3/aarch32/include \
-I/home/pengdonglin/disk_ext/Third_Part/Readline/aarch32/include \
-I/home/pengdonglin/disk_ext/Third_Part/Termcap/aarch32/include \
-I/home/pengdonglin/disk_ext/Third_Part/Zlib/aarch32/include"\
LDLAST="-L/home/pengdonglin/disk_ext/Third_Part/Readline/aarch32/lib \
-L/home/pengdonglin/disk_ext/Third_Part/Termcap/aarch32/lib \
-L/home/pengdonglin/disk_ext/Third_Part/Zlib/aarch32/lib" make -j4
make install
安装完成后,也可以直接将lib/python3.6/lib-dynload/zlib.cpython-36m-arm-linux-gnueabi.so拷贝到板子上面的/usr/lib/python3.6/lib-dynload/下面即可, 而不必全部更新
- 编译Python2:
#!/bin/bash ../Python-2.7./configure --prefix=`pwd` \
--host=arm-none-linux-gnueabi \
--build=x86_64-linux-gnu \
--enable-ipv6 \
--enable-shared \
ac_cv_file__dev_ptmx="yes" \
ac_cv_file__dev_ptc="no" \
LDFLAGS="-L/home/pengdonglin/disk_ext/Third_Part/SQlite3/aarch32/lib \
-L/home/pengdonglin/disk_ext/Third_Part/Readline/aarch32/lib \
-L/home/pengdonglin/disk_ext/Third_Part/Termcap/aarch32/lib \
-L/home/pengdonglin/disk_ext/Third_Part/Zlib/aarch32/lib"\
CPPFLAGS="-I/home/pengdonglin/disk_ext/Third_Part/SQlite3/aarch32/include \
-I/home/pengdonglin/disk_ext/Third_Part/Readline/aarch32/include \
-I/home/pengdonglin/disk_ext/Third_Part/Termcap/aarch32/include \
-I/home/pengdonglin/disk_ext/Third_Part/Zlib/aarch32/include"\
LDLAST="-L/home/pengdonglin/disk_ext/Third_Part/Readline/aarch32/lib \
-L/home/pengdonglin/disk_ext/Third_Part/Termcap/aarch32/lib \
-L/home/pengdonglin/disk_ext/Third_Part/Zlib/aarch32/lib"\
#!/bin/bash make HOSTPYTHON=../x86_64/python \
HOSTPGEN=../x86_64/Parser/pgen \
BLDSHARED="arm-none-linux-gnueabi-gcc -shared" \
CROSS_COMPILE=arm-none-linux-gnueabi- \
CROSS_COMPILE_TARGET=yes \
HOSTARCH=arm-none-linux-gnueabi \
BUILDARCH=x86_64-linux-gnu \
-j4
#!/bin/bash make install HOSTPYTHON=../x86_64/python \
BLDSHARED="arm-none-linux-gnueabi-gcc -shared" \
CROSS_COMPILE=arm-none-linux-gnueabi- \
CROSS_COMPILE_TARGET=yes \
prefix=`pwd`
安装完成后,也可以直接将lib/python2.7/lib-dynload/zlib.so拷贝到开发板的/usr/lib/python2.7/lib-dynload/下面,而不用全部更新
- 然后修改mk_ramdisk.sh:
#!/bin/bash thiry_part=/home/pengdonglin/disk_ext/Third_Part/
cross_compile=/home/pengdonglin/disk_ext/Cross_Compiler/aarch32/ sudo rm -rf rootfs
sudo rm -rf tmpfs
sudo rm -rf ramdisk*
sudo losetup -d /dev/loop0
sudo losetup /dev/loop0 ./fs_vexpress_1G.img
sudo partprobe /dev/loop0 sudo mkdir rootfs
sudo cp ${thiry_part}/Busybox/aarch32/_install/* rootfs/ -raf sudo mkdir -p rootfs/proc/
sudo mkdir -p rootfs/sys/
sudo mkdir -p rootfs/tmp/
sudo mkdir -p rootfs/root/
sudo mkdir -p rootfs/var/
sudo mkdir -p rootfs/mnt/ sudo cp etc rootfs/ -arf sudo cp -arf ${cross_compile}/arm-2014.05/arm-none-linux-gnueabi/libc/lib rootfs/ #Python3
sudo mkdir -p rootfs/usr
pushd rootfs/usr
sudo cp -raf /home/pengdonglin/disk_ext/Python/Python3/aarch32/bin .
sudo cp -raf /home/pengdonglin/disk_ext/Python/Python3/aarch32/lib .
sudo cp -raf /home/pengdonglin/disk_ext/Python/Python3/aarch32/include .
sudo cp -raf /home/pengdonglin/disk_ext/Python/Python3/aarch32/share . #Python2
sudo cp -raf /home/pengdonglin/disk_ext/Python/Python2/aarch32/bin .
sudo cp -raf /home/pengdonglin/disk_ext/Python/Python2/aarch32/lib .
sudo cp -raf /home/pengdonglin/disk_ext/Python/Python2/aarch32/include .
sudo cp -raf /home/pengdonglin/disk_ext/Python/Python2/aarch32/share .
popd #SQlite3
sudo cp -raf /home/pengdonglin/disk_ext/Third_Part/SQlite3/aarch32/bin/* rootfs/bin/
sudo cp -raf /home/pengdonglin/disk_ext/Third_Part/SQlite3/aarch32/include/* rootfs/include/
sudo cp -raf /home/pengdonglin/disk_ext/Third_Part/SQlite3/aarch32/lib/* rootfs/lib/
sudo cp -raf /home/pengdonglin/disk_ext/Third_Part/SQlite3/aarch32/share/* rootfs/usr/share #Readline
sudo cp -raf /home/pengdonglin/disk_ext/Third_Part/Readline/aarch32/include/ rootfs/include/
sudo cp -raf /home/pengdonglin/disk_ext/Third_Part/Readline/aarch32/lib/* rootfs/lib/ #Zlib
sudo cp -raf /home/pengdonglin/disk_ext/Third_Part/Zlib/aarch32/include/* rootfs/include/
sudo cp -raf /home/pengdonglin/disk_ext/Third_Part/Zlib/aarch32/lib/* rootfs/lib/ #BeautifulSoup4
sudo cp -raf /home/pengdonglin/disk_ext/Python/BeautifulSoup4/beautifulsoup4-4.5.3/bs4 rootfs/usr/lib/python2.7/site-packages
sudo cp -raf /home/pengdonglin/disk_ext/Python/BeautifulSoup4/beautifulsoup4-4.5.3/py3k/bs4 rootfs/usr/lib/python3.6/site-packages #Requests
sudo cp -raf /home/pengdonglin/disk_ext/Python/Requests/requests-2.3.0/requests rootfs/usr/lib/python2.7/site-packages
sudo cp -raf /home/pengdonglin/disk_ext/Python/Requests/requests-2.3.0/requests rootfs/usr/lib/python3.6/site-packages #Boa
sudo cp -raf /home/pengdonglin/disk_ext/Third_Part/WebServer/Boa/boa-0.94.13/src/boa rootfs/bin
sudo mkdir -p rootfs/usr/lib/boa
sudo cp -raf /home/pengdonglin/disk_ext/Third_Part/WebServer/Boa/boa-0.94.13/src/boa_indexer rootfs/usr/lib/boa
sudo mkdir -p rootfs/var/www/cgi-bin
sudo mkdir -p rootfs/var/log/boa sudo rm -rf rootfs/lib/*.a
sudo arm-none-linux-gnueabi-strip rootfs/lib/* rootfs/bin/*
sudo arm-none-linux-gnueabi-strip rootfs/usr/lib/boa/*
sudo arm-none-linux-gnueabi-strip rootfs/usr/lib/*
sudo arm-none-linux-gnueabi-strip rootfs/usr/bin/*
sudo arm-none-linux-gnueabi-strip rootfs/bin/* sudo mkdir -p rootfs/dev/
sudo mknod rootfs/dev/tty1 c 4 1
sudo mknod rootfs/dev/tty2 c 4 2
sudo mknod rootfs/dev/tty3 c 4 3
sudo mknod rootfs/dev/tty4 c 4 4
sudo mknod rootfs/dev/console c 5 1
sudo mknod rootfs/dev/null c 1 3 sudo mkdir ./tmpfs/
sudo mount -t ext4 /dev/loop0p1 ./tmpfs/
sudo rm -rf ./tmpfs/*
sudo cp -raf rootfs/* ./tmpfs/ sleep 2
sudo umount ./tmpfs/ sudo losetup -d /dev/loop0
3、测试
[root@vexpress ]# python3
Python 3.6. (default, May , ::)
[GCC 4.8. (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>>
[root@vexpress ]# python2
Python 2.7. (default, May , ::)
[GCC 4.8. (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>>
#!/usr/bin/env python2 import requests
import time apiurl = "http://api.yeelink.net/v1.0/device/7445/sensor/405914/datapoints"
apiheaders = {'U-ApiKey':'3957bd54eaddd2fda1f35841d52776d9'} while True:
r = requests.get(apiurl, headers=apiheaders)
print(r.text)
sw = r.json()
if sw['value'] == 1:
print("Switch On")
elif sw['value'] == 0:
print("Switch Off")
time.sleep(2)
#!/usr/bin/env python3 import requests
import time apiurl = "http://api.yeelink.net/v1.0/device/7445/sensor/405914/datapoints"
apiheaders = {'U-ApiKey':'3957bd54eaddd2fda1f35841d52776d9'} while True:
r = requests.get(apiurl, headers=apiheaders)
print(r.text)
sw = r.json()
if sw['value'] == 1:
print("Switch On")
elif sw['value'] == 0:
print("Switch Off")
time.sleep(2)
Yeelink初步体验的更多相关文章
- MongoDB3.6之Replica Set初步体验
Replica Set在国内叫做副本集,简单来说就是一份数据在多个地方存储. 1.为什么要用副本集,什么时候使用副本集? 有人说一份数据在多个地方存储占用了大量的额外空间,是一种浪 ...
- mysql connector c++ 1.1 API初步体验
mysql connector c++ 1.1 API初步体验 1,常用的头文件 #include <mysql_connection.h> #include <mysql_driv ...
- 移动端之Android开发的几种方式的初步体验
目前越来越多的移动端混合开发方式,下面列举的大多数我都略微的尝试过,就初步的认识写个简单的心得: 开发方式 开发环境 是否需要AndroidSDK 支持跨平台 开发语言&技能 MUI Win+ ...
- express 框架初步体验
一. 安装express 1.打开cmd 全局安装express 输入:npm install -gd express 2. 安装命令行工具,不然你输入express 会出现 不是内部命令. 输入: ...
- 2014年新一代的报表利器 Qlik Sense Desktop 初步体验
点击进入 QlikView/QlikSense 社区 交流群:432998033 Qlik Sense Desktop 的案例展示 先上几个刚刚边看边学完成的几个报表案例效果 (如果图片显示不正常, ...
- 中国移动MIFI--CM510,4G TD-LTE MIFI 上网终端开箱及初步体验@上海
上海的,前期在4G官网报名专页登记了http://www.10086.cn/lte/recruit.html 当时由于报名结束了,所以先注册登记了信息. 1.15号中午收到10086的短信邀请,立马报 ...
- 初步体验libsvm用法1(官方自带工具)
在机器学习和模式识别领域,svm理论使用得很广泛,其理论基础是统计学习,但是如果我们的研究方向不是svm理论,我们只是利用已有的svm工具来对我们的任务进行分类和回归,那么libsvm是一个不错的选择 ...
- 初步体验javascript try catch机制
javascript在ECMAScript3中引入了try catch finally机制,大致原理和其他语言一样. 我们也可以自定义错误事件. 但是事先声明:我们自定义的错误事件,只支持对name. ...
- 【Struts2】新建一个Struts2工程,初步体验MVC
实现目标 地址栏输入http://localhost:88/Struts2HelloWorld/helloworld.jsp 输入用户名,交由http://localhost:88/Struts2He ...
随机推荐
- centos6.7编译安装mysql5.7.17
centos6.7编译安装mysql5.7.17 2017-03-24 09:57:15 提示:mysql5.7.17和之前5.56以前的版本安装不一样,需要用cmake 另外,看本文档的mysql编 ...
- iOS开发之使程序在后台运行
方法一(此方法不太可靠): 开启程序后台运行: [application beginBackgroundTaskWithExpirationHandler:^{ //后台运行过期后会调用此block内 ...
- 会话管理(Cookie/Session技术)
什么是会话:用户打开浏览器,点击多个超链接,访问服务器的多个web资源,然后关闭浏览器,整个过程就称为一个会话: 会话过程需要解决的问题:每个用户在使用浏览器与服务器进行会话的过程中,都可能会产生一些 ...
- Sql(in与exists)
1.如果查询的两表大小相当,那么用in和exists差别不大,如果两个表中一个较小一个较大,则子查询表小的用exists,子查询表大的用in. 2.not in逻辑上不完全等同于not exists, ...
- Zkdash安装
zkdash是一个zookeeper的管理界面,也可以作为任何基于zookeeper的配置管理工具,比如:Qconf 1.拉取代码 #git clone https://github.com/irea ...
- 性能调优之提高 ASP.NET Web 应用性能的 24 种方法和技巧
性能调优之提高 ASP.NET Web 应用性能的 24 种方法和技巧 poptest是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性能测试,测试工具开发等工作为目标.如果对 ...
- 手机自动化测试:Appium源码分析之跟踪代码分析九
手机自动化测试:Appium源码分析之跟踪代码分析九 poptest是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性能测试,测试工具开发等工作为目标.如果对课程感兴趣,请大家 ...
- 性能调优之SQL优化
poptest是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性能测试,测试工具开发等工作为目标.如果对课程感兴趣,请大家咨询qq:908821478,咨询电话010-845052 ...
- iOS 给UITextView加一个placeholder
苹果并没有为UITextView提供placeholder功能.我们可以通过两种办法实现. 方法一: 思路:设置默认显示的文字,颜色设置为灰色.代理方法监听textView点击. 缺点:如果点击到文字 ...
- grep的用法笔记
1.grep搜索不保护字符串的命令格式如下: #带-v参数 jevan@df ~ grep "agc" -vRn ./