用网线连接上PYNQ板子,打开9090端口上的 jupyter notebook,选择Terminal打开终端
(如果是用 USB 连接上的可以参考这篇文章在设备管理器里查看端口并用 putty 或 Tera Term 连接)
查看当前板子上的 python 版本和系统版本
emmmm反正我今天试了这几个版本都说是不支持,除了0.11.0的那个,我想还是装一个1.1.0的,这个好歹有tf的版本号而且是针对 arm设计的,另外那个针对所有平台的 0.11.0 不知道什么来历
这个直接 pip 装不上,可能是因为现在板子上的版本是 3.6的,我在考虑要不要卸了装个 3.4的
但是卸载这个操作感觉比较危险
考虑不卸载情况下重新搞一个新的软链接
3.31 更新
可能还是得重装.. Anaconda 就是好啊可以直接管理多个虚拟环境..
看下面这个链接说的要升级版本的话是跟 ubuntu 一样的
How to upgrade the python version in PYNQ Z2 board - Support - PYNQ
看官方文档还是得用数据线连接访问串口、因为我担心用网线访问 jupyter notebook 的 terminal 会卸载失败..
先买一条公对公的 USB 数据线吧之后再说..
可能还是联网的问题
准备给PYNQ联网、用公对公USB连接试试
4.4更新
今天用 USB 公对公试了一下、我的电脑的设备管理器一直没有端口选项、解决方案见这里 虽然之后加了端口设备还是连不上..
我现在是给 PYNQ 联网之后 ipconfig 一下,直接在浏览器访问 9090 端口的 jupyter 的 terminal
如何给 PYNQ 联网
这里用自己的电脑桥接给 PYNQ 即共享网络,也有用无线网卡连接 Wifi 的、这要求自己的电脑又两个网卡(无线网卡连 Wifi、有线网卡连PYNQ)
FPGA | PYNQ使用USB WiFi(无线网卡)教程_Circuit_Ideer的博客-优快云博客_fpga wifi
打开网络共享中心->选择当前无线网络 Wifi->选择属性 -> 共享 -> 共享给把子连接到的以太网
打开板子的terminal,ping 一下百度成功即可
然后又今天看了给PYNQ的tf2,里面说必须得装 3.5GitHub - franout/tensorflow_for_pynqz2: tensorflor 2.1 wheel for pynq z2 ( zynq 7000 xilinx SoC ), cross compiled with different compiler's flags using the script provided by tensorflow for building it for rasberry
然后我按照这个教程在不卸载 3.6的情况下安装了3.5
linux centos 安装python3.5 (不卸载老版本)_Fei-joe的博客-优快云博客
现在我的板子上的python3.5的访问方式是 python3.5 (在/usr/bin下新建了这个软链接)
4.5更新
佛了,昨天还能连上网的,今天死活ping不通,而且打开terminal反应巨慢...
我真的很想找一张新的卡、重新往里面烧镜像、现在这个板子上的镜像是2.6版本的、换个低版本的镜像是不是能有低版本的python(好像不能、这个版本好像只是xilinx工具套件的版本)
现在是装上了python3.5、但是现在pip3指定的是在python3.6上安装的、上网看说下面这个命令可以指定pip是给哪个版本的python安装
python3.5 -m pip install XXX
然后这样显示我的python3.5没有装pip
看到一个同时管理3.5和3.6的python和pip的帖子
多版本Python安装pip及pip版本管理终极教程 - 知乎
首先给python3.5下一个 get-pip.py
curl https://bootstrap.pypa.io/pip/3.5/get-pip.py -o get-pip.py
然后用python3.5执行一下这个脚本
python3.5 get-pip.py
然而一直显示pip21在2021年1月就不支持python3.5了...还说连不上Links for pip..但是我电脑是能打开的啊..
找到一个新的教程、按这个教程给python3.5装的pip
linux 下安装python3.5 和 pip_r_rmax的博客-优快云博客_linux安装pip3.5
建立软链接的时候
ln -s /usr/local/python3.5/bin/pip /usr/bin/pip3.5
然而现在我输入pip3.5显示
找了一个帖子Python3 使用pip3报错 ImportError: cannot import name 'HTTPSHandler' 解决_天下皆白_唯我独黑的博客-优快云博客
网上说可能是ssl的问题
输入openssl发现能用、(输入exit退出回到普通terminal
进pyhton3.5看看能不能import ssl
不能。。。网上说是python3.5没装好所以不能用ssl...
另一篇也说是要重装python3.5。。。
解决ImportError: cannot import name HTTPSHandler - 暮良文王 - 博客园
。。。下午装了ssl再重装吧。。
注:PYNQ上没有yum,我直接用的 apt-get install
今天下午板子又连不上了。。连上了反应也很慢。。真的玄学。。直接关电源让它歇半个钟再开就很顺利连上了。。
这个py3.6能连上啊。。直接删除python3.5的安装目录重新make。。
make的时候报的一些warning
然后make和make install的时候其实有报error..
重装3.5之后还是import不了ssl..
重新想想、3.6能import成功但是3.5不能、 肯定不是网上说的没安装ssl的问题、应该是3.5的配置问题
看到这个ubuntu安装python3.6_小小写的博客-优快云博客_ubantu安装python3.6
应该把 /usr/local/Python-3.5.0/Modules(tar解压出来的目录)中的Setup.dist和Setup修改一下
都需要将默认注释掉的关于ssl的5行取消,大约在53%处。
# CSV file helper
#_csv _csv.c
# Socket module helper for socket(2)
_socket socketmodule.c
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/usr/local/ssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
然后再次删掉安装目录。。指定安装目录之后make clean再重新编译试一下。。
关于_ssl.c的报错如下
gcc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement
-I. -IInclude -I./Include -DPy_BUILD_CORE -DUSE_SSL -I/usr/local/ssl/include -I/usr/local/ssl/include/openssl -c ./Modules/_ssl.c -o Modules/_ssl.o
./Modules/_ssl.c: In function ‘newPySSLSocket’:
./Modules/_ssl.c:528:9: warning: implicit declaration of function ‘CRYPTO_add’; did you mean ‘CRYPTO_free’? [-Wimplicit-function-declaration]
CRYPTO_add(&inbio->bio->references, 1, CRYPTO_LOCK_BIO);
^~~~~~~~~~
CRYPTO_free
./Modules/_ssl.c:528:31: error: dereferencing pointer to incomplete type ‘BIO {aka struct bio_st}’
CRYPTO_add(&inbio->bio->references, 1, CRYPTO_LOCK_BIO);
^~
./Modules/_ssl.c:528:48: error: ‘CRYPTO_LOCK_BIO’ undeclared (first use in this function); did you mean ‘CRYPTO_LOCK’?
CRYPTO_add(&inbio->bio->references, 1, CRYPTO_LOCK_BIO);
^~~~~~~~~~~~~~~
CRYPTO_LOCK
./Modules/_ssl.c:528:48: note: each undeclared identifier is reported only once for each function it appears in
./Modules/_ssl.c: In function ‘_create_tuple_for_X509_NAME’:
./Modules/_ssl.c:740:35: error: dereferencing pointer to incomplete type ‘X509_NAME_ENTRY {aka struct X509_name_entry_st}’
if (rdn_level != entry->set) {
^~
./Modules/_ssl.c: In function ‘_get_peer_alt_names’:
./Modules/_ssl.c:855:16: error: dereferencing pointer to incomplete type ‘X509_EXTENSION {aka struct X509_extension_st}’
p = ext->value->data;
^~
./Modules/_ssl.c:927:17: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations]
v = PyUnicode_FromStringAndSize((char *)ASN1_STRING_data(as),
^
In file included from /usr/include/openssl/bn.h:31:0,
from /usr/include/openssl/asn1.h:24,
from /usr/include/openssl/rsa.h:16,
from ./Modules/_ssl.c:59:
/usr/include/openssl/asn1.h:553:1: note: declared here
DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
^
./Modules/_ssl.c: In function ‘_get_crl_dp’:
./Modules/_ssl.c:1080:22: error: dereferencing pointer to incomplete type ‘X509 {aka struct x509_st}’
dps = certificate->crldp;
./Modules/_ssl.c: In function ‘_ssl__SSLSocket_shared_ciphers_impl’:
./Modules/_ssl.c:1459:23: error: dereferencing pointer to incomplete type ‘SSL_SESSION {aka struct ssl_session_st}’
if (!sess || !sess->ciphers)
^~
./Modules/_ssl.c: In function ‘_ssl__SSLSocket_compression_impl’:
./Modules/_ssl.c:1570:43: error: dereferencing pointer to incomplete type ‘COMP_METHOD {aka const struct comp_method_st}’
if (comp_method == NULL || comp_method->type == NID_undef)
^~
./Modules/_ssl.c: In function ‘_ssl__SSLContext_impl’:
./Modules/_ssl.c:2229:9: warning: ‘TLSv1_method’ is deprecated [-Wdeprecated-declarations]
ctx = SSL_CTX_new(TLSv1_method());
^~~
In file included from /usr/include/openssl/ct.h:13:0,
from /usr/include/openssl/ssl.h:61,
from ./Modules/_ssl.c:64:
/usr/include/openssl/ssl.h:1624:1: note: declared here
DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_method(void)) /* TLSv1.0 */
^
./Modules/_ssl.c:2232:9: warning: ‘TLSv1_1_method’ is deprecated [-Wdeprecated-declarations]
ctx = SSL_CTX_new(TLSv1_1_method());
^~~
In file included from /usr/include/openssl/ct.h:13:0,
from /usr/include/openssl/ssl.h:61,
from ./Modules/_ssl.c:64:
/usr/include/openssl/ssl.h:1630:1: note: declared here
DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_method(void)) /* TLSv1.1 */
^
./Modules/_ssl.c:2234:9: warning: ‘TLSv1_2_method’ is deprecated [-Wdeprecated-declarations]
ctx = SSL_CTX_new(TLSv1_2_method());
^~~
In file included from /usr/include/openssl/ct.h:13:0,
from /usr/include/openssl/ssl.h:61,
from ./Modules/_ssl.c:64:
/usr/include/openssl/ssl.h:1636:1: note: declared here
DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_method(void)) /* TLSv1.2 */
./Modules/_ssl.c:2242:27: warning: implicit declaration of function ‘SSLv2_method’; did you mean ‘SSLv23_method’? [-Wimplicit-function-declaration]
ctx = SSL_CTX_new(SSLv2_method());
^~~~~~~~~~~~
SSLv23_method
./Modules/_ssl.c:2242:27: warning: passing argument 1 of ‘SSL_CTX_new’ makes pointer from integer without a cast [-Wint-conversion]
In file included from ./Modules/_ssl.c:64:0:
/usr/include/openssl/ssl.h:1333:17: note: expected ‘const SSL_METHOD * {aka const struct ssl_method_st *}’ but argument is of type ‘int’
__owur SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
^~~~~~~~~~~
./Modules/_ssl.c: In function ‘get_verify_flags’:
./Modules/_ssl.c:2560:46: error: dereferencing pointer to incomplete type ‘X509_STORE {aka struct x509_store_st}’
flags = X509_VERIFY_PARAM_get_flags(store->param);
^~
./Modules/_ssl.c: In function ‘_ssl__SSLContext_load_cert_chain_impl’:
./Modules/_ssl.c:2760:48: error: dereferencing pointer to incomplete type ‘SSL_CTX {aka struct ssl_ctx_st}’
pem_password_cb *orig_passwd_cb = self->ctx->default_passwd_callback;
^~
./Modules/_ssl.c: In function ‘_ssl__SSLContext_cert_store_stats_impl’:
./Modules/_ssl.c:3421:20: error: dereferencing pointer to incomplete type ‘X509_OBJECT {aka struct x509_object_st}’
switch (obj->type) {
^~
./Modules/_ssl.c:3431:18: error: ‘X509_LU_PKEY’ undeclared (first use in this function); did you mean ‘X509_PKEY’?
case X509_LU_PKEY:
^~~~~~~~~~~~
X509_PKEY
./Modules/_ssl.c: In function ‘PySSL_RAND’:
./Modules/_ssl.c:3849:9: warning: ‘RAND_pseudo_bytes’ is deprecated [-Wdeprecated-declarations]
ok = RAND_pseudo_bytes((unsigned char*)PyBytes_AS_STRING(bytes), len);
^~
In file included from /usr/include/openssl/ct.h:13:0,
from /usr/include/openssl/ssl.h:61,
from ./Modules/_ssl.c:64:
/usr/include/openssl/rand.h:47:1: note: declared here
DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
^
At top level:
./Modules/_ssl.c:4364:13: warning: ‘_ssl_thread_locking_function’ defined but not used [-Wunused-function]
static void _ssl_thread_locking_function
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/_ssl.c:4351:1: warning: ‘_ssl_threadid_callback’ defined but not used [-Wunused-function]
_ssl_threadid_callback(CRYPTO_THREADID *id)
^~~~~~~~~~~~~~~~~~~~~~
Makefile:1731: recipe for target 'Modules/_ssl.o' failed
make: *** [Modules/_ssl.o] Error 1
又查到一篇我这状况的
安装python3之后无法引用_ssl_已解决_博问_博客园
人家是已经改好了安装路径的..我先看下我的openssl到底装在哪了..
把上面两个文件改一下路径..(默认是在/usr/local/ssl)
https://q.cnblogs.com/q/112667/https://q.cnblogs.com/q/112667/
告诉我/usr/bin/openssl不是一个目录..看一下到底openssl的安装目录在哪里
...这三个好像也不太对
输入openssl version -a
设置为/usr/lib/ssl也不行,照帖子里说的拷贝一下试试..
看到一个报错和我一样的c++ - Python 3.4.3 failed to build these modules: _hashlib _ssl - Stack Overflow
PYNQ不是fedora,所以我按照这篇文章装了 libssl1.0-dev
ubuntu20.04安装libssl1.0-dev_tang05709的博客-优快云博客_apt-get install libssl1.0-dev
由于之前装过旧版本的libssl,再问你要不要卸载老的那些库的时候输入Y即可,然后make再make install
啊啊啊啊啊啊啊好像装上了!!!!!而且setuptools和pip都装上了,直接建立软链接就可以
ln -s /usr/local/python3.5/bin/pip3 /usr/bin/pip3.5
建软连接的时候如果说已经又存在的,删掉后再建就行
然后输入pip3.5就得到这样
sudo pip3.5 install pynq
这个命令得执行一段时间、、可以喝个咖啡、、
装不上、最后一行提示说现在3.5的pip是版本7的、、最新版已经到22了、、
然后我就用建议的命令安装了一下、、pip3.5直接崩了、、pip3.5 --version都报错、、
又重装pip
wget https://bootstrap.pypa.io/pip/3.5/get-pip.py
python3.5 get-pip.py
重新试一下 sudo pip3.5 install pynq、说没有符合的版本
..不行
试试装个numpy、可以、就是有点久
再试一下装pynq还是不行、换源也不行、直接import也没有...而且pip版本是7的时候不用镜像也可以找到的...明天再说吧
明天试一下不装pynq直接装3.4和3.5的tf
4.8
我是如何只用一根网线连着笔记本就给PYNQ连上网的:
1、先给板子连上电和网线、等蓝灯亮起说明板子的系统已经正常启动、把板子的地址设定为192.168.2.1、然后等一下(。。。
2、确认在未联网的时候连上了板子,即访问https://192.168.2.99:9090 可以打开jupyter
3、打开笔记本上的WLAN,选择共享到以太网(这一步要弹出窗口显示设定地址为192.168.0.1或其他地址才能连上网,点确定)
这个时候板子被自动设定的地址是这样的
4、打开浏览器,访问http://pynq:9090/tree?#
5、打开jupyter的terminal、ping通www.baidu.com即可
然后在浏览器jupyter的terminal输入ifconfig查看当前板子被分配的地址
可以在本机的git bash上输入
ssh xilinx@192.168.xx.xx(刚才查看联网后的板子的地址
输入密码xilinx
输入su 再输入密码xilinx
即可连上(这个是有颜色的、、比浏览器那个完全黑白的稍微好看一点)
4.8下午更新
我真的装烦了
不装pynq这个库直接照着https://github.com/franout/tensorflow_for_pynqz2#set-up-target装tf倒是有反应
但是今天又抱了一大堆错、、懒得截图了、、
大概意思是先警告说python3.5在21年就不受pip3.5的支持了、然后一大堆库本地找不到也没有链接下载、然后各种找不到安装文件报错、、
真的有一种被时代抛弃的感觉、、
就是说什么时候才能统一这个AI的软硬架构啊、、美好的梦想罢了、、
直接装上网友说的0.11.0的版本吧
直接一下就装上了、、我真的怀疑这个版本能干什么、、
看一下都有什么可以用的函数
https://docs.rs/crate/tensorflow/0.11.0/source/
试着运行了一下示例里的regression、报错说AttributeError: module 'tensorflow' has no attribute 'variables_initializer'
addition.py报错说 File "./addition.py", line 5, in <module> assert tf_major_version == '2' AssertionError
网上说的用tf.compat.v1.global_variables_initializer()代替也不行、我打算现在自己电脑上装下用一下看看都有什么函数怎么用
看了一下这个课程基于PYNQ平台——快速入门神经网络的建模与硬件_Moore8摩尔吧
过程大概是:
在随便哪个平台上用tensorflow训练并生成网络权重.dat文件
写一个.c文件把.dat文件转成.bin文件(或者直接用py读取w,to_file直接输入.bin文件名即可
PYNQ的电路读.bin文件
然后通过读取矩阵、在c语言中手写矩阵乘法进行每一层的运算
在pynq中把一种运算变成电路
然后开始手算..
总结就是并不用在PYNQ上装 tf。。。
看看怎么训练、照着教程调用一下ip核吧、、
参考链接
Xilinx-PYNQ_Z2系列-学习笔记(13):在PYNQ-Z2上安装Keras/Tensorflow 库的方法_赵小琛在路上的博客-优快云博客_pynq tensorflowInstall Tensorflow on PYNQ – LogicTronix
Xilinx-PYNQ_Z2系列-学习笔记(13):在PYNQ-Z2上安装Keras/Tensorflow 库的方法_赵小琛在路上的博客-优快云博客_pynq tensorflow