網頁

2019年6月22日 星期六

Nvidia Jetson AGX Xavier 安裝 tensorflow

安裝虛擬環境
nvidia@jetson-0423418048807:~/XavierSSD$ sudo apt-get install python3-pip
nvidia@jetson-0423418048807:~/XavierSSD$ sudo apt-get install build-essential libssl-dev libffi-dev python-dev
nvidia@jetson-0423418048807:~/XavierSSD$ sudo apt-get install python3-venv
nvidia@jetson-0423418048807:~/XavierSSD$ mkdir envs
nvidia@jetson-0423418048807:~/XavierSSD$ cd envs
nvidia@jetson-0423418048807:~/XavierSSD/envs$ python3 -m venv tensorflow
nvidia@jetson-0423418048807:~/XavierSSD/envs$ cd
啟動虛擬環境
nvidia@jetson-0423418048807:~$ source ~/XavierSSD/envs/tensorflow/bin/activate
(tensorflow) nvidia@jetson-0423418048807:~$ 

設定 OpenCV
(tensorflow) nvidia@jetson-0423418048807:~$ sudo find / -name "cv2*"
find: ‘/run/user/1001/gvfs’: Permission denied
/usr/lib/python2.7/dist-packages/cv2.so
/usr/lib/python3.6/dist-packages/cv2.cpython-36m-aarch64-linux-gnu.so
(tensorflow) nvidia@jetson-0423418048807:~$ cd XavierSSD/envs/tensorflow/lib/python3.6/site-packages/
(tensorflow) nvidia@jetson-0423418048807:~/XavierSSD/envs/tensorflow/lib/python3.6/site-packages$ ln -s /usr/lib/python3.6/dist-packages/cv2.cpython-36m-aarch64-linux-gnu.so

測試 OpenCV
(tensorflow) nvidia@jetson-0423418048807:~$ python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> print(cv2.__version__)
3.3.1
>>> exit()

大部份的安裝說明文件,第一步都是要你先安裝 JetPack 或 NVIDIA SDK Manager
其實都已經安裝完,參考 Nvidia Jetson AGX Xavier 安裝

$ sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev
$ pip3 install -U numpy grpcio absl-py py-cpuinfo psutil portpicker six mock requests gast h5py astor termcolor protobuf keras-applications keras-preprocessing wrapt google-pasta

直接下載安裝
(tensorflow) nvidia@jetson-0423418048807:~$ pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu --ignore-installed

若是因為網路下載失敗
用網頁開啟 https://developer.download.nvidia.com/compute/redist/jp/v42/tensorflow-gpu/
下載 https://developer.download.nvidia.com/compute/redist/jp/v42/tensorflow-gpu/

(tensorflow) nvidia@jetson-0423418048807:~/XavierSSD/Downloads$ pip3 install tensorflow_gpu-1.13.1+nv19.5-cp36-cp36m-linux_aarch64.whl 

測試 tensorflow
(tensorflow) nvidia@jetson-0423418048807:~/XavierSSD/Downloads$ python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> hello = tf.constant('Hello Tensorflow')
>>> sess = tf.Session()
>>> print(sess.run(hello))
b'Hello Tensorflow'
>>> exit()
(tensorflow) nvidia@jetson-0423418048807:~/XavierSSD/Downloads$ 


沒有留言:

張貼留言