斐讯N1盒子转AArch64 debain

家里收拾东西时发现有这个东东,留着也没用,于是搜了下网上的教程,在上面刷了个armdebian,性能比树莓派要好很多, 装个docker,和树莓派组个小集群吧。
 

debian.PNG

 
ssh就好了,别整x11,稳定性太渣了
家里收拾东西时发现有这个东东,留着也没用,于是搜了下网上的教程,在上面刷了个armdebian,性能比树莓派要好很多, 装个docker,和树莓派组个小集群吧。
 

debian.PNG

 
ssh就好了,别整x11,稳定性太渣了

Raspberrypi 2 Install or upgrade Python3.6

Since no chinese input method in my raspberrypi, i can only write with English.
 
Raspberrypi has python2. 7 and python3.4, but i want to upgrade to python3.6+.
 
Python3.6 support some new feature such as print(f'{name}') and x=1_000_242_200 expression.
 
How to upgrade ?
 

$ wget https://www.python.org/ftp/pyt ... 1.tgz 
$ tar zxvf Python-3.6.1.tgz $ cd Python-3.6.1

then run command:

$ sudo ./configure && sudo make && sudo make install

wait for about 20mins (low perf of raspberrypi :( )
 
then you run command:
python3
 
it will using the new python3.6 version:
 


Python 3.6.1 (default, Jul 21 2019, 14:26:28) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
 


 
Enjoy it !
继续阅读 »
Since no chinese input method in my raspberrypi, i can only write with English.
 
Raspberrypi has python2. 7 and python3.4, but i want to upgrade to python3.6+.
 
Python3.6 support some new feature such as print(f'{name}') and x=1_000_242_200 expression.
 
How to upgrade ?
 

$ wget https://www.python.org/ftp/pyt ... 1.tgz 
$ tar zxvf Python-3.6.1.tgz $ cd Python-3.6.1

then run command:

$ sudo ./configure && sudo make && sudo make install

wait for about 20mins (low perf of raspberrypi :( )
 
then you run command:
python3
 
it will using the new python3.6 version:
 


Python 3.6.1 (default, Jul 21 2019, 14:26:28) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
 


 
Enjoy it ! 收起阅读 »

mongo服务启动失败: ERROR: mmap private failed with out of memory

平时在树莓派上开机自动执行以下命令,启动mongo服务
sudo mongod --fork --dbpath /home/pi/mongo/db/ --smallfiles --journal --logpath /home/pi/mongo/log.txt

突然今天发现mongo的服务连不上,看log发现mongo在启动后马上关闭了,提示的错误是在加载一个大的数据文件的时候提示内存不足(坑爹的,树莓派自身内存才1GB,无法扩容)。 
 
错误日志:
Sun May 13 12:08:11.185 [initandlisten] MongoDB starting : pid=1929 port=27017 dbpath=/home/pi/mongo/db/ 32-bit host=raspberrypi
Sun May 13 12:08:11.186 [initandlisten]
Sun May 13 12:08:11.186 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Sun May 13 12:08:11.186 [initandlisten] ** 32 bit builds are limited to less than 2GB of data (or less with --journal).
Sun May 13 12:08:11.186 [initandlisten] ** See http://dochub.mongodb.org/core/32bit
Sun May 13 12:08:11.187 [initandlisten]
Sun May 13 12:08:11.187 [initandlisten] db version v2.4.10
Sun May 13 12:08:11.187 [initandlisten] git version: nogitversion
Sun May 13 12:08:11.187 [initandlisten] build info: Linux bm-wb-04 3.19.0-trunk-armmp #1 SMP Debian 3.19.1-1~exp1+plugwash1 (2015-03-28) armv7l BOOST_LIB_VERSION=1_55
Sun May 13 12:08:11.187 [initandlisten] allocator: system
Sun May 13 12:08:11.187 [initandlisten] options: { dbpath: "/home/pi/mongo/db/", fork: true, journal: true, logpath: "/home/pi/mongo/mongod.log" }
Sun May 13 12:08:11.198 [initandlisten] journal dir=/home/pi/mongo/db/journal
Sun May 13 12:08:11.198 [initandlisten] recover : no journal files present, no recovery needed
Sun May 13 12:08:11.238 [initandlisten] ERROR: mmap private failed with out of memory. You are using a 32-bit build and probably need to upgrade to 64
Sun May 13 12:08:11.239 [initandlisten] Assertion: 13636:file /home/pi/mongo/db/xueqiu.5 open/create failed in createPrivateMap (look in log for more information)
0x662fa8 0x63527c 0x6196c0 0x6197bc 0x409d5c 0x4414fc 0x2ea634 0x2eaa3c 0x2eb55c 0x2ebd98 0x26f998 0x26fb94 0x175a20 0x177bf4 0x152bf0 0x76556294
mongod(_ZN5mongo15printStackTraceERSo+0x1c) [0x662fa8]
mongod(_ZN5mongo10logContextEPKc+0x110) [0x63527c]
mongod(_ZN5mongo11msgassertedEiPKc+0xc0) [0x6196c0]
mongod(_ZN5mongo18msgassertedNoTraceEiPKc+0) [0x6197bc]
mongod(_ZN5mongo8MongoMMF13finishOpeningEv+0x308) [0x409d5c]
mongod(_ZN5mongo13MongoDataFile12openExistingEPKc+0x9c) [0x4414fc]
mongod(_ZN5mongo8Database16openExistingFileEi+0x23c) [0x2ea634]
mongod(_ZN5mongo8Database12openAllFilesEv+0x24) [0x2eaa3c]
mongod(_ZN5mongo8DatabaseC2EPKcRbRKSs+0x158) [0x2eb55c]
mongod(_ZN5mongo14DatabaseHolder11getOrCreateERKSsS2_Rb+0x500) [0x2ebd98]
mongod(_ZN5mongo6Client7Context11_finishInitEv+0x34) [0x26f998]
mongod(_ZN5mongo6Client7ContextC1ERKSsS3_b+0x78) [0x26fb94]
mongod(_ZN5mongo14_initAndListenEi+0xb00) [0x175a20]
mongod(_ZN5mongo13initAndListenEi+0x14) [0x177bf4]
mongod(main+0x2b8) [0x152bf0]
/lib/arm-linux-gnueabihf/libc.so.6(__libc_start_main+0x114) [0x76556294]
Sun May 13 12:08:11.250 [initandlisten] warning database /home/pi/mongo/db/ xueqiu could not be opened
Sun May 13 12:08:11.251 [initandlisten] DBException 13636: file /home/pi/mongo/db/xueqiu.5 open/create failed in createPrivateMap (look in log for more information)
Sun May 13 12:08:11.251 [initandlisten] exception in initAndListen: 13636 file /home/pi/mongo/db/xueqiu.5 open/create failed in createPrivateMap (look in log for more information), terminating
Sun May 13 12:08:11.251 dbexit:
Sun May 13 12:08:11.252 [initandlisten] shutdown: going to close listening sockets...
Sun May 13 12:08:11.252 [initandlisten] shutdown: going to flush diaglog...
Sun May 13 12:08:11.252 [initandlisten] shutdown: going to close sockets...
Sun May 13 12:08:11.252 [initandlisten] shutdown: waiting for fs preallocator...
Sun May 13 12:08:11.252 [initandlisten] shutdown: lock for final commit...
Sun May 13 12:08:11.252 [initandlisten] shutdown: final commit...
Sun May 13 12:08:11.252 [initandlisten] shutdown: closing all files...
Sun May 13 12:08:11.252 [initandlisten] closeAllFiles() finished
Sun May 13 12:08:11.252 [initandlisten] journalCleanup...
Sun May 13 12:08:11.253 [initandlisten] removeJournalFiles
Sun May 13 12:08:11.263 [initandlisten] shutdown: removing fs lock...
Sun May 13 12:08:11.264 dbexit: really exiting now

看了下mongod的用法,尝试把参数 --journal,去掉,重新运行,然后就可以了。
 
sudo mongod --fork --dbpath /home/pi/mongo/db/ --smallfiles --logpath /home/pi/mongo/log.txt
继续阅读 »
平时在树莓派上开机自动执行以下命令,启动mongo服务
sudo mongod --fork --dbpath /home/pi/mongo/db/ --smallfiles --journal --logpath /home/pi/mongo/log.txt

突然今天发现mongo的服务连不上,看log发现mongo在启动后马上关闭了,提示的错误是在加载一个大的数据文件的时候提示内存不足(坑爹的,树莓派自身内存才1GB,无法扩容)。 
 
错误日志:
Sun May 13 12:08:11.185 [initandlisten] MongoDB starting : pid=1929 port=27017 dbpath=/home/pi/mongo/db/ 32-bit host=raspberrypi
Sun May 13 12:08:11.186 [initandlisten]
Sun May 13 12:08:11.186 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Sun May 13 12:08:11.186 [initandlisten] ** 32 bit builds are limited to less than 2GB of data (or less with --journal).
Sun May 13 12:08:11.186 [initandlisten] ** See http://dochub.mongodb.org/core/32bit
Sun May 13 12:08:11.187 [initandlisten]
Sun May 13 12:08:11.187 [initandlisten] db version v2.4.10
Sun May 13 12:08:11.187 [initandlisten] git version: nogitversion
Sun May 13 12:08:11.187 [initandlisten] build info: Linux bm-wb-04 3.19.0-trunk-armmp #1 SMP Debian 3.19.1-1~exp1+plugwash1 (2015-03-28) armv7l BOOST_LIB_VERSION=1_55
Sun May 13 12:08:11.187 [initandlisten] allocator: system
Sun May 13 12:08:11.187 [initandlisten] options: { dbpath: "/home/pi/mongo/db/", fork: true, journal: true, logpath: "/home/pi/mongo/mongod.log" }
Sun May 13 12:08:11.198 [initandlisten] journal dir=/home/pi/mongo/db/journal
Sun May 13 12:08:11.198 [initandlisten] recover : no journal files present, no recovery needed
Sun May 13 12:08:11.238 [initandlisten] ERROR: mmap private failed with out of memory. You are using a 32-bit build and probably need to upgrade to 64
Sun May 13 12:08:11.239 [initandlisten] Assertion: 13636:file /home/pi/mongo/db/xueqiu.5 open/create failed in createPrivateMap (look in log for more information)
0x662fa8 0x63527c 0x6196c0 0x6197bc 0x409d5c 0x4414fc 0x2ea634 0x2eaa3c 0x2eb55c 0x2ebd98 0x26f998 0x26fb94 0x175a20 0x177bf4 0x152bf0 0x76556294
mongod(_ZN5mongo15printStackTraceERSo+0x1c) [0x662fa8]
mongod(_ZN5mongo10logContextEPKc+0x110) [0x63527c]
mongod(_ZN5mongo11msgassertedEiPKc+0xc0) [0x6196c0]
mongod(_ZN5mongo18msgassertedNoTraceEiPKc+0) [0x6197bc]
mongod(_ZN5mongo8MongoMMF13finishOpeningEv+0x308) [0x409d5c]
mongod(_ZN5mongo13MongoDataFile12openExistingEPKc+0x9c) [0x4414fc]
mongod(_ZN5mongo8Database16openExistingFileEi+0x23c) [0x2ea634]
mongod(_ZN5mongo8Database12openAllFilesEv+0x24) [0x2eaa3c]
mongod(_ZN5mongo8DatabaseC2EPKcRbRKSs+0x158) [0x2eb55c]
mongod(_ZN5mongo14DatabaseHolder11getOrCreateERKSsS2_Rb+0x500) [0x2ebd98]
mongod(_ZN5mongo6Client7Context11_finishInitEv+0x34) [0x26f998]
mongod(_ZN5mongo6Client7ContextC1ERKSsS3_b+0x78) [0x26fb94]
mongod(_ZN5mongo14_initAndListenEi+0xb00) [0x175a20]
mongod(_ZN5mongo13initAndListenEi+0x14) [0x177bf4]
mongod(main+0x2b8) [0x152bf0]
/lib/arm-linux-gnueabihf/libc.so.6(__libc_start_main+0x114) [0x76556294]
Sun May 13 12:08:11.250 [initandlisten] warning database /home/pi/mongo/db/ xueqiu could not be opened
Sun May 13 12:08:11.251 [initandlisten] DBException 13636: file /home/pi/mongo/db/xueqiu.5 open/create failed in createPrivateMap (look in log for more information)
Sun May 13 12:08:11.251 [initandlisten] exception in initAndListen: 13636 file /home/pi/mongo/db/xueqiu.5 open/create failed in createPrivateMap (look in log for more information), terminating
Sun May 13 12:08:11.251 dbexit:
Sun May 13 12:08:11.252 [initandlisten] shutdown: going to close listening sockets...
Sun May 13 12:08:11.252 [initandlisten] shutdown: going to flush diaglog...
Sun May 13 12:08:11.252 [initandlisten] shutdown: going to close sockets...
Sun May 13 12:08:11.252 [initandlisten] shutdown: waiting for fs preallocator...
Sun May 13 12:08:11.252 [initandlisten] shutdown: lock for final commit...
Sun May 13 12:08:11.252 [initandlisten] shutdown: final commit...
Sun May 13 12:08:11.252 [initandlisten] shutdown: closing all files...
Sun May 13 12:08:11.252 [initandlisten] closeAllFiles() finished
Sun May 13 12:08:11.252 [initandlisten] journalCleanup...
Sun May 13 12:08:11.253 [initandlisten] removeJournalFiles
Sun May 13 12:08:11.263 [initandlisten] shutdown: removing fs lock...
Sun May 13 12:08:11.264 dbexit: really exiting now

看了下mongod的用法,尝试把参数 --journal,去掉,重新运行,然后就可以了。
 
sudo mongod --fork --dbpath /home/pi/mongo/db/ --smallfiles --logpath /home/pi/mongo/log.txt
收起阅读 »

pymongo连接树莓派的mongo server出现错误

客户端在ubuntu,安装的是pymongo, 服务端在树莓派,运行的是mongod的服务。
 
出现以下的错误:
 /usr/local/lib/python2.7/dist-packages/pymongo/topology_description.pyc in check_compatible(self)
    119         """
    120         if self._incompatible_err:
--> 121             raise ConfigurationError(self._incompatible_err)
    122 
    123     def has_server(self, address):

ConfigurationError: Server at raspberrypi:27017 reports wire version 0, but this version of PyMongo requires at least 2 (MongoDB 2.6).
 
##################### 问题排除 #####################
因为使用ubuntu连接本机的mongd server,没有出现这个问题。 所以问题应该处在版本上。
然后把pymongo的版本降下去,原来是3.6的版本,然后降到3.2. 重试后问题就解决了。
 
sudo pip install pymongo==3.2
 
继续阅读 »
客户端在ubuntu,安装的是pymongo, 服务端在树莓派,运行的是mongod的服务。
 
出现以下的错误:
 /usr/local/lib/python2.7/dist-packages/pymongo/topology_description.pyc in check_compatible(self)
    119         """
    120         if self._incompatible_err:
--> 121             raise ConfigurationError(self._incompatible_err)
    122 
    123     def has_server(self, address):

ConfigurationError: Server at raspberrypi:27017 reports wire version 0, but this version of PyMongo requires at least 2 (MongoDB 2.6).
 
##################### 问题排除 #####################
因为使用ubuntu连接本机的mongd server,没有出现这个问题。 所以问题应该处在版本上。
然后把pymongo的版本降下去,原来是3.6的版本,然后降到3.2. 重试后问题就解决了。
 
sudo pip install pymongo==3.2
  收起阅读 »

树莓派中使用matplotlib出错 TypeError: constructor returned NULL

 
 File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk3agg.py", line 11, in <module>
from . import backend_gtk3
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk3.py", line 54, in <module>
cursors.MOVE : Gdk.Cursor.new(Gdk.CursorType.FLEUR),
TypeError: constructor returned NULL
 
上面的代码是在树莓派上运行出错的,而在本地的ubuntu上正常运行没问题。
后面查了下资料,原因是我用了ssh登录到树莓派,所以X11的模块没有被正常加载。
按照以下方法就可以解决问题了:
 
在代码中添加以下这一句:
matplotlib.use("Pdf")
 
而且这一句要在import matplotlib.pyplot as plt这句前面添加。
 
OK。
继续阅读 »
 
 File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk3agg.py", line 11, in <module>
from . import backend_gtk3
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk3.py", line 54, in <module>
cursors.MOVE : Gdk.Cursor.new(Gdk.CursorType.FLEUR),
TypeError: constructor returned NULL
 
上面的代码是在树莓派上运行出错的,而在本地的ubuntu上正常运行没问题。
后面查了下资料,原因是我用了ssh登录到树莓派,所以X11的模块没有被正常加载。
按照以下方法就可以解决问题了:
 
在代码中添加以下这一句:
matplotlib.use("Pdf")
 
而且这一句要在import matplotlib.pyplot as plt这句前面添加。
 
OK。 收起阅读 »

树莓派时间修改为中国本地时间

树莓派默认的时间为UTC时间,运行date命令,返回的是:

date_pi.jpg

 
很容易看出,和中国时间相差了八个小时。这是由于树莓派默认显示的是UTC,也就是国际时区的时间。
 
解决方案如下:

 

首先,我们要了解一个东东,它的名字叫做NTP。

NTP(Network Time Protocol,网络时间协议)是用来使网络中的各个计算机时间同步的一种协议。

 

第一步:安装NTP,输入指令“sudo apt-get install ntpdate ”。

 

第二步:启用NTP,输入指令“sudo timedatectl set-ntp true”。

 

第三步:修改本地时区,输入指令“sudo dpkg-reconfigure tzdata”。

在这一步中,我选的是“asia/shanghai”时区。
 
再次输入“date”指令:

 
date_pi1.jpg



可见已经顺利变成本地时间CST。
 
继续阅读 »
树莓派默认的时间为UTC时间,运行date命令,返回的是:

date_pi.jpg

 
很容易看出,和中国时间相差了八个小时。这是由于树莓派默认显示的是UTC,也就是国际时区的时间。
 
解决方案如下:

 

首先,我们要了解一个东东,它的名字叫做NTP。

NTP(Network Time Protocol,网络时间协议)是用来使网络中的各个计算机时间同步的一种协议。

 

第一步:安装NTP,输入指令“sudo apt-get install ntpdate ”。

 

第二步:启用NTP,输入指令“sudo timedatectl set-ntp true”。

 

第三步:修改本地时区,输入指令“sudo dpkg-reconfigure tzdata”。

在这一步中,我选的是“asia/shanghai”时区。
 
再次输入“date”指令:

 
date_pi1.jpg



可见已经顺利变成本地时间CST。
  收起阅读 »

树莓派上安装redis-server 亲测

采用的方法为到官网下载源码,然后在树莓派上编译。
 
1. 下载源码压缩包:
官方网址: https://redis.io/download
下载下来的格式为tar.gz
通过命令行解压: tar xvfz xxxxxx.tar.gz
 
2. 解压后进入 redis-4.0.0的目录,然后执行命令: make
 
3. 等待源码编译(树莓派上有点久), 见到这一行:Hint: It's a good idea to run 'make test' ;)
说明你安装成功了
 
4. 编译成功后, 记得运行命令 sudo src/redis-server
来启动redis server。
 
成功运行后的文字界面:
12718:C 17 Jul 23:09:24.447 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo

12718:C 17 Jul 23:09:24.448 # Redis version=4.0.0, bits=64, commit=00000000, modified=0, pid=12718, just started

12718:C 17 Jul 23:09:24.448 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf

12718:M 17 Jul 23:09:24.450 * Increased maximum number of open files to 10032 (it was originally set to 256).

                _._                                                  

           _.-``__ ''-._                                             

      _.-``    `.  `_.  ''-._           Redis 4.0.0 (00000000/0) 64 bit

  .-`` .-```.  ```\/    _.,_ ''-._                                   

 (    '      ,       .-`  | `,    )     Running in standalone mode

 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379

 |    `-._   `._    /     _.-'    |     PID: 12718

  `-._    `-._  `-./  _.-'    _.-'                                   

 |`-._`-._    `-.__.-'    _.-'_.-'|                                  

 |    `-._`-._        _.-'_.-'    |           http://redis.io        

  `-._    `-._`-.__.-'_.-'    _.-'                                   

 |`-._`-._    `-.__.-'    _.-'_.-'|                                  

 |    `-._`-._        _.-'_.-'    |                                  

  `-._    `-._`-.__.-'_.-'    _.-'                                   

      `-._    `-.__.-'    _.-'                                       

          `-._        _.-'                                           

              `-.__.-'                                               




12718:M 17 Jul 23:09:24.451 # Server initialized

12718:M 17 Jul 23:09:24.451 * Ready to accept connections
继续阅读 »
采用的方法为到官网下载源码,然后在树莓派上编译。
 
1. 下载源码压缩包:
官方网址: https://redis.io/download
下载下来的格式为tar.gz
通过命令行解压: tar xvfz xxxxxx.tar.gz
 
2. 解压后进入 redis-4.0.0的目录,然后执行命令: make
 
3. 等待源码编译(树莓派上有点久), 见到这一行:Hint: It's a good idea to run 'make test' ;)
说明你安装成功了
 
4. 编译成功后, 记得运行命令 sudo src/redis-server
来启动redis server。
 
成功运行后的文字界面:
12718:C 17 Jul 23:09:24.447 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo

12718:C 17 Jul 23:09:24.448 # Redis version=4.0.0, bits=64, commit=00000000, modified=0, pid=12718, just started

12718:C 17 Jul 23:09:24.448 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf

12718:M 17 Jul 23:09:24.450 * Increased maximum number of open files to 10032 (it was originally set to 256).

                _._                                                  

           _.-``__ ''-._                                             

      _.-``    `.  `_.  ''-._           Redis 4.0.0 (00000000/0) 64 bit

  .-`` .-```.  ```\/    _.,_ ''-._                                   

 (    '      ,       .-`  | `,    )     Running in standalone mode

 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379

 |    `-._   `._    /     _.-'    |     PID: 12718

  `-._    `-._  `-./  _.-'    _.-'                                   

 |`-._`-._    `-.__.-'    _.-'_.-'|                                  

 |    `-._`-._        _.-'_.-'    |           http://redis.io        

  `-._    `-._`-.__.-'_.-'    _.-'                                   

 |`-._`-._    `-.__.-'    _.-'_.-'|                                  

 |    `-._`-._        _.-'_.-'    |                                  

  `-._    `-._`-.__.-'_.-'    _.-'                                   

      `-._    `-.__.-'    _.-'                                       

          `-._        _.-'                                           

              `-.__.-'                                               




12718:M 17 Jul 23:09:24.451 # Server initialized

12718:M 17 Jul 23:09:24.451 * Ready to accept connections 收起阅读 »

dataframe 将某列字符类型转为日期类型

现有dataframe数据变量df,其中列my_date是类似于2017-11-01这样的字符数据。
注意,这里dataframe没有很智能地把你的日期字符转为datatime格式
而需要手工转换
 
df['my_date']=df['my_date'].astype('datetime64')
 
调用astype 函数就可以了。
 
查看 df.dtypes
就可以看到数据的类型发生了改变。

 
继续阅读 »
现有dataframe数据变量df,其中列my_date是类似于2017-11-01这样的字符数据。
注意,这里dataframe没有很智能地把你的日期字符转为datatime格式
而需要手工转换
 
df['my_date']=df['my_date'].astype('datetime64')
 
调用astype 函数就可以了。
 
查看 df.dtypes
就可以看到数据的类型发生了改变。

  收起阅读 »

树莓派2代 接通用usb摄像头

首先下载必要的usb播放工具
使用apt-get可以很方便下载到
sudo apt-get install fswebcam
sudo apt-get install mplayer
sudo apt-get install alsamixer

安装后接入usb摄像头,在命令行下执行
sudo ls /dev/video0




154057zp3w3go3vvizbrlq.png


如果有这一个设备,说明你的usb摄像头兼容你的树莓派的驱动,不然还的额外去找第三方的摄像头驱动。

接着可以直接在命令行打开摄像头
sudo mplayer tv://

然后选择一个画面进行拍摄
sudo fswebcam -no-banner -r 640*480 image.jpg

154058ks2w6tvt2zv4t9dw.png


大功告成。
继续阅读 »
首先下载必要的usb播放工具
使用apt-get可以很方便下载到
sudo apt-get install fswebcam
sudo apt-get install mplayer
sudo apt-get install alsamixer

安装后接入usb摄像头,在命令行下执行
sudo ls /dev/video0




154057zp3w3go3vvizbrlq.png


如果有这一个设备,说明你的usb摄像头兼容你的树莓派的驱动,不然还的额外去找第三方的摄像头驱动。

接着可以直接在命令行打开摄像头
sudo mplayer tv://

然后选择一个画面进行拍摄
sudo fswebcam -no-banner -r 640*480 image.jpg

154058ks2w6tvt2zv4t9dw.png


大功告成。 收起阅读 »