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 ...
随机推荐
- 关于Trie KMP AC自动机
个人认为trie,KMP,AC自动机是思想非常明确的,AC自动机的性质是与KMP算法的思想类似的(失配后跳转) 而KMP是线性的,AC自动机是在tire树上跑KMP,为方便那些不会用指针的小朋友(我也 ...
- sass学习笔记 -- sass的四种编译方法
sass的四种编译方法:(.scss) (一)ruby下的命令行编译 首先需要安装ruby,注意需勾选Add Ruby executables to your PATH选项,以添加环境变量. ruby ...
- 老司机实战Windows Server Docker:4 单节点Windows Docker服务器简单运维(下)
上篇中,我们主要介绍了使用docker-compose对Windows Docker单服务器进行远程管理,编译和部署镜像,并且设置容器的自动启动.但是,还有一些重要的问题没有解决,这些问题不解决,就完 ...
- MYSQL数据库-修改和删除
删除数据库: $ DROP DATABASE t_name; 重命名一张表: $ RENAME TABLE ori_name TO new_name; $ ALTER TABLE ori_name R ...
- 在linux下使用百度ueditor编辑器上传图片
百度ueditor编辑器虽然强大,但是也有不足的地方.如果对ueditor流程不是很熟悉可以说走的弯路比较多,费力不讨好.下面呢,就是要解决ueditor遇到的问题. 用ueditor上传图片遇到的问 ...
- linux下处理excel里copy的某列的字符串,去除行末空格并添加特殊字段
背景:从excel里copy出一列数据到txt,然后放到linux下处理,发现每一行末尾都是固定个数的空格,我想要在每行字符串末尾加固定字段并逗号隔开输出, 1.将特定字段取出,去掉每行末尾的不定个数 ...
- Plupload上传插件简单整理
Plupload Plupload是有TinyMCE的开发者开发的,为您的内容管理系统或是类似上传程序提供一个高度可用的上传插件.Plupload 目前分为一个核心API 和一个jQuery上传队列部 ...
- js 操作 cookie
js 操作 cookie 的方法如下: //设置cookie function setCookie(cname, cvalue, exdays) { var d = new Date(); d.set ...
- HackerRank The Chosen One [预处理][gcd]
题解:tags:[预处理][gcd]故事背景:光头钻进了茫茫人海.这是一个典型の通过前缀后缀和来降低复杂度的问题.先用pre数组与suf数组分别维护前缀gcd和后缀gcd.如果 a[i] % gcd( ...
- github上预览Demo网页最简单的方法
github上预览Demo网页最简单的方法: 1.打开你github上demo网页index.html,效果如图 2.复制上面的页面地址,然后在该地址前加上 htmlpreview.github.co ...