香橙派orangepi4b上安装tensorflow与transformer

0. 环境
香橙派4
Orangepi4_2.1.2_ubuntu_bionic_desktop_linux4.4.179.7z

插上TTL
注意WIN10无法使用CP2102,CH340可以,经过测试FT232也可以。
波特率 1500000
登陆root/orangepi或者orangepi/orangepi

1. python3.7
wget https://www.python.org/ftp/python/3.7.13/Python-3.7.13.tgz

sudo tar -xvf Python-3.7.13.tgz
cd /Python-3.7.13

确认gcc g++
gcc -v 
g++ -v

sudo ./configure --prefix=/usr/local/python37

make -j6
sudo make install

创建软链接
sudo ln -s /usr/local/python37/bin/python3.7  /usr/bin/python3.7
sudo ln -s /usr/bin/python3.7  /usr/bin/python3

sudo ln -s /usr/local/python37/bin/python3.7  /usr/bin/python3.7
sudo ln -s /usr/local/python37/bin/pip3.7  /usr/bin/pip3


板子设置pip源
mkdir ~/.pip
vim ~/.pip/pip.conf

[global]
index-url=http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com

2. tensorflow
https://tf.kmtea.eu/whl/stable.html
复制tensorflow-2.7.0-cp37-cp37m-linux_aarch64.whl到板子上

安装tensorflow
pip3 install tensorflow-2.7.0-cp37-cp37m-linux_aarch64.whl

验证
orangepi@orangepi4:/usr/bin$ python3
Python 3.7.13 (default, Mar 31 2022, 03:01:08)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> print(hello)
tf.Tensor(b'Hello, TensorFlow!', shape=(), dtype=string)
>>> ^Z
[12]+  Stopped                 python3
orangepi@orangepi4:/usr/bin$

3. transformers
pip3 install transformers
python3
from transformers import pipeline
classifier = pipeline('sentiment-analysis')
classifier('We are very happy to introduce pipeline to the transformers repository.')

开机内存大概400M,运行后内存850M。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值