https://www.jianshu.com/p/1fac6cdedd0d
Jetson nano的镜像已经自带了JetPack,cuda,cudnn,opencv组件和sample,这些例子安装路径如下所示
TensorRT /usr/src/tensorrt/samples/ CUDA /usr/local/cuda-/samples/ cuDNN /usr/src/cudnn_samples_v7/ Multimedia API /usr/src/tegra_multimedia_api/ VisionWorks /usr/share/visionworks/sources/samples/ /usr/share/visionworks-tracking/sources/samples/ /usr/share/visionworks-sfm/sources/samples/ OpenCV /usr/share/OpenCV/samples/
root@jetson-desktop:/# nvcc -V -bash: nvcc: command not found
加入路径
vi ~/.bashrc 文件最后加入 export CUBA_HOME=/usr/local/cuda-10.0 export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH export PATH=/usr/local/cuda-10.0/bin:$PATH 执行使生效 source ~/.bashrc
再次执行,显示cuda10.0
root@jetson-desktop:/# source ~/.bashrc root@jetson-desktop:/# nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2018 NVIDIA Corporation Built on Sun_Sep_30_21:09:22_CDT_2018 Cuda compilation tools, release 10.0, V10.0.166 root@jetson-desktop:/#
root@jetson-desktop:/# pkg-config opencv --modversion 3.3.1
显示opencv当前版本是3.3.1
root@jetson-desktop:/# cd /usr/src/cudnn_samples_v7/mnistCUDNN/ root@jetson-desktop:/usr/src/cudnn_samples_v7/mnistCUDNN# make /usr/local/cuda/bin/nvcc -ccbin g++ -I/usr/local/cuda/include -IFreeImage/include -m64 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_53,code=compute_53 -o fp16_dev.o -c fp16_dev.cu g++ -I/usr/local/cuda/include -IFreeImage/include -o fp16_emu.o -c fp16_emu.cpp g++ -I/usr/local/cuda/include -IFreeImage/include -o mnistCUDNN.o -c mnistCUDNN.cpp /usr/local/cuda/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_53,code=compute_53 -o mnistCUDNN fp16_dev.o fp16_emu.o mnistCUDNN.o -I/usr/local/cuda/include -IFreeImage/include -LFreeImage/lib/linux/aarch64 -LFreeImage/lib/linux -lcudart -lcublas -lcudnn -lfreeimage -lstdc++ -lm FreeImage/lib/linux/aarch64/libfreeimage.a(strenc.o): In function `StrIOEncInit‘: strenc.c:(.text+0x1294): warning: the use of `tmpnam‘ is dangerous, better use `mkstemp‘
root@jetson-desktop:/# python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
root@jetson-desktop:/# apt-get install python3-pip 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 root@jetson-desktop:/# pip3 -V pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
升级下版本到19.1;
root@jetson-desktop:~# python3 -m pip install --upgrade pip Collecting pip Downloading https://files.pythonhosted.org/packages/f9/fb/863012b13912709c13cf5cfdbfb304fa6c727659d6290438e1a88df9d848/pip-19.1-py2.py3-none-any.whl (1.4MB) 100% |████████████████████████████████| 1.4MB 279kB/s Installing collected packages: pip Found existing installation: pip 9.0.1 Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr Successfully installed pip-19.1 root@jetson-desktop:~# pip3 -V pip 19.1 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
root@jetson-desktop:/# sudo apt-get install python3-opencv
测试下看看
root
root@jetson-desktop:~# python3 Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> print(cv2.__version__) 3.2.0 >>>
默认3.2版本,和系统本身自带的不统一;
python2.7版本自带的opencv
root@jetson-desktop:~# python Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> print(cv2.__version__) File "<stdin>", line 1 print(cv2.__version__) ^ IndentationError: unexpected indent >>> print(cv2.__version__) 3.3.1 >>>
python3能安装的opencv版本太低;稍后再解决;
apt-get update && apt-get upgrade -y
原文:https://www.cnblogs.com/kekeoutlook/p/13511212.html