Jetson AGX Xavier踩坑记录

1. 联网后,升级所有安装包,并且更新了一下系统

 sudo  apt-get update

2. 安装中文输入法

sudo  apt-get install fcitx-googlepinyin

3. 安装nano文本编辑器,比较喜欢这个文本编辑器(不需要学啥命令)。本来喜欢用gedit,但是上一次在Jetson的linux中,sudo gedit的界面刷新有问题,不明白为什么。不过这次系统就没有这个毛病了

sudo  apt-get install nano

4. 安装pip3

https://pypi.org/搜索pip,我当前最新版本是19.2.2

点击installation的链接后,官方告诉用下面命令安装:

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

可是系统默认没有curl,于是先安装curl

$ sudo apt-get install curl

5. 在自己的home创建一个dowload文件夹,执行curl那条命令,下载了一个叫做get-pip.py的文件

6. 按照官方的要求,执行sudo python3 get-pip.py

$ sudo python3 get-pip.py
WARNING: The directory '/home/cpt/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/home/cpt/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
  Downloading https://files.pythonhosted.org/packages/8d/07/f7d7ced2f97ca3098c16565efbe6b15fafcba53e8d9bdb431e09140514b0/pip-19.2.2-py2.py3-none-any.whl (1.4MB)
     |████████████████████████████████| 1.4MB 333kB/s 
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/ec/51/f45cea425fd5cb0b0380f5b0f048ebc1da5b417e48d304838c02d6288a1e/setuptools-41.0.1-py2.py3-none-any.whl (575kB)
     |████████████████████████████████| 583kB 8.6MB/s 
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/bb/10/44230dd6bf3563b8f227dbf344c908d412ad2ff48066476672f3a72e174e/wheel-0.33.4-py2.py3-none-any.whl
ERROR: launchpadlib 1.10.6 requires testresources, which is not installed.
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-19.2.2 setuptools-41.0.1 wheel-0.33.4
cpt@cie-jetson:~/download$ 

虽然中间有一个红色错误行,但是还是安装成功了,可以在终端窗口输入一个pip3试一下就知道了

7. 安装Opencv

Jetpack中已经自带了opencv,但是在python3中import的时候并不能成功

$ 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
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: numpy.core.multiarray failed to import
>>> 

看来是需要安装Numpy。在安装Numpy之前,我们先看看我们的Opencv的版本吧(失败方法):

$ sudo pip3 show opencv-python
$ sudo pip3 show opencv-contrib-python 
$ sudo pip show opencv-python

经过上面3个命令,都无法获取opencv的版本。。。

网上搜一下怎么获取,得知可以在python中看(注意此处用的是python2,因为上面我们已经试过了,python3中无法import cv2)

$ python
Python 2.7.15+ (default, Nov 27 2018, 23:36:35) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> print cv2.__version__
3.3.1
>>> 

通过官方网站点击到这个页面:https://docs.opencv.org/4.1.1/da/df6/tutorial_py_table_of_contents_setup.html

按照里面的指导安装Opencv,两种方式

  • Install from pre-built binaries available in Ubuntu repositories
  • Compile from the source. In this section, we will see both.

作为小白,我喜欢pre-built binaries方式。(官方说用sudo apt-get install python-opencv安装,但是我的系统中要在Python3中使用,所以稍微改一下,否则将会被安装在Python 2环境中了。)

$ sudo apt-get install python3-opencv

官方说Opencv依赖Numpy:

Another important thing is the additional libraries required. OpenCV-Python requires only Numpy (in addition to other dependencies, which we will see later). But in this tutorials, we also use Matplotlib for some easy and nice plotting purposes (which I feel much better compared to OpenCV). Matplotlib is optional, but highly recommended. Similarly we will also see IPython, an Interactive Python Terminal, which is also highly recommended.

不过我们不需要再安装了,因为在装Opencv的时候numpy就被自动安装了(import的时候没有错误提示,说明已经安装了)

$ 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
>>> import numpy
>>> print (cv2.__version__)
3.2.0
>>> print (numpy.__version__)
1.13.3
>>> 

版本貌似不高,先不升级。

再尝试用pip3查看版本:

$ sudo pip3 show numpy
Name: numpy
Version: 1.13.3
Summary: NumPy: array processing for numbers, strings, records, and objects.
Home-page: http://www.numpy.org
Author: NumPy Developers
Author-email: numpy-discussion@python.org
License: BSD
Location: /usr/lib/python3/dist-packages
Requires: 
Required-by: uff
$ sudo pip3 show cv2
$ sudo pip3 show python3-opencv
$ 

发现pip3还是无法获取opencv的版本。或许我的指令有误吧,希望高手指点一下。

8. 安装Tensorflow

打开nvidia的官方网站nvidia.cn,拉到底下:

选择开发者--下载,最后来到这个URL页面

https://developer.nvidia.com/embedded/downloads

搜索里面搜所tensorflow

按照最新版本的提示,安装tensorflow

(1)安装依赖库

$ sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev

(2)升级pip3

$ sudo apt-get install python3-pip
$ sudo pip3 install -U pip

(3)继续安装升级依赖库

$ sudo 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 setuptools testresources

  (4) 在官方主页下载tensorflow的whl文件(这个文件可以用Pip3进行安装)

(5) 安装tensorflow,此处注意,install后面跟的是你下载来的文件在本地的实际路径。

cpt@cie-jetson: sudo pip3 install ~/download/tensorflow_gpu-1.14.0+nv19.7-cp36-cp36m-linux_aarch64.whl

  (6) 检查安装是否成功(别看那么多信息,没关系,不影响咱们使用):

$ 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
2019-08-13 11:14:24.951197: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
>>> print (tf.__version__)
1.14.0
>>> 

至此,开发环境搭建完成。

 

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值