Darknet - YOLO - /bin/sh: 1: nvcc: not found

Darknet - YOLO - /bin/sh: 1: nvcc: not found

1. darket_work

yongqiang@amax-server:~$ ssh [email protected]
[email protected]'s password: 
Welcome to Ubuntu 16.04.4 LTS (GNU/Linux 4.4.0-116-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

81 packages can be updated.
35 updates are security updates.


Last login: Sat Jun  2 19:19:41 2018 from 192.168.1.122
yongqiang@DN-S3:~$ cd darknet_work/
yongqiang@DN-S3:~/darknet_work$ cd darknet_180606/
yongqiang@DN-S3:~/darknet_work/darknet_180606$ cd darknet/
yongqiang@DN-S3:~/darknet_work/darknet_180606/darknet$ ls
LICENSE       LICENSE.gen  LICENSE.meta  LICENSE.v1  README.md  cfg   examples  obj     results  src
LICENSE.fuck  LICENSE.gpl  LICENSE.mit   Makefile    backup     data  include   python  scripts
yongqiang@DN-S3:~/darknet_work/darknet_180606/darknet$ vim Makefile 

2. vim Makefile
GPU=1
CUDNN=0
OPENCV=0
OPENMP=0
DEBUG=0

3. compile error

yongqiang@DN-S3:~/darknet_work/darknet_180606/darknet$ make clean
yongqiang@DN-S3:~/darknet_work/darknet_180606/darknet$ make
……
gcc -Iinclude/ -Isrc/ -DGPU -I/usr/local/cuda/include/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DGPU -c ./src/yolo_layer.c -o obj/yolo_layer.o
nvcc  -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -Iinclude/ -Isrc/ -DGPU -I/usr/local/cuda/include/ --compiler-options "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DGPU" -c ./src/convolutional_kernels.cu -o obj/convolutional_kernels.o
/bin/sh: 1: nvcc: not found
Makefile:88: recipe for target 'obj/convolutional_kernels.o' failed
make: *** [obj/convolutional_kernels.o] Error 127
yongqiang@DN-S3:~/darknet_work/darknet_180606/darknet$
yongqiang@DN-S3:~$ which nvcc
yongqiang@DN-S3:~$ 

4. /etc/profile
/etc/profile contains Linux system wide environment and startup programs. It is used by all users with bash, ksh, sh shell. Usually used to set PATH variable, user limits, and other settings for user. It only runs for login shell. If you wanted to make large changes or application specific changes use /etc/profile.d directory.
/etc/profile 包含 Linux 系统范围的环境和启动程序。所有用户都可以通过 bash、ksh、sh shell 使用它。通常用于为用户设置 PATH 变量、用户限制和其他设置。它只运行登录 shell。如果要进行大的更改或特定于应用程序的更改,请使用 /etc/profile.d 目录。

在 /etc/profile 文件中修改环境变量,修改的内容是对所有用户起作用的。在 /etc/profile 文件末尾添加如下环境变量。
Set up the development environment by modifying the PATH and LD_LIBRARY_PATH variables.

4.1 CUDA Toolkit 8.0
CUDA Toolkit 8.0 开发环境变量设置。

yongqiang@DN-S3:~/darknet_work/darknet_180606/darknet$ cd /usr/local/
yongqiang@DN-S3:/usr/local$ ls
bin  cuda  cuda-8.0  etc  games  include  lib  man  sbin  share  src
yongqiang@DN-S3:/usr/local$ ll
total 44
drwxr-xr-x 11 root root 4096 May 25 18:24 ./
drwxr-xr-x 10 root root 4096 May 25 18:12 ../
drwxr-xr-x  2 root root 4096 May 25 18:15 bin/
lrwxrwxrwx  1 root root   19 May 25 18:24 cuda -> /usr/local/cuda-8.0/
drwxr-xr-x 17 root root 4096 May 25 18:24 cuda-8.0/
drwxr-xr-x  2 root root 4096 Mar  1 02:23 etc/
drwxr-xr-x  2 root root 4096 Mar  1 02:23 games/
drwxr-xr-x  2 root root 4096 Mar  1 02:23 include/
drwxr-xr-x  4 root root 4096 May 25 15:22 lib/
lrwxrwxrwx  1 root root    9 May 25 14:49 man -> share/man/
drwxr-xr-x  2 root root 4096 Mar  1 02:23 sbin/
drwxr-xr-x  7 root root 4096 May 25 18:12 share/
drwxr-xr-x  2 root root 4096 Mar  1 02:23 src/

yongqiang@DN-S3:~$ sudo vim /etc/profile
[sudo] password for yongqiang:


在 /etc/profile 文件末尾添加如下环境变量。

# foreverstrong
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}


Darknet - YOLO - /bin/sh: 1: nvcc: not found_第1张图片
 

4.2 CUDA Toolkit 9.0

yongqiang@DN-S3:~$ ll /usr/local/
总用量 44
drwxr-xr-x 11 root root 4096 10月 17 22:39 ./
drwxr-xr-x 11 root root 4096 3月   1  2018 ../
drwxr-xr-x  2 root root 4096 3月   1  2018 bin/
lrwxrwxrwx  1 root root   19 10月 17 22:39 cuda -> /usr/local/cuda-9.0/
drwxr-xr-x 18 root root 4096 10月 17 22:39 cuda-9.0/
drwxr-xr-x  2 root root 4096 3月   1  2018 etc/
drwxr-xr-x  2 root root 4096 3月   1  2018 games/
drwxr-xr-x  2 root root 4096 3月   1  2018 include/
drwxr-xr-x  4 root root 4096 3月   1  2018 lib/
lrwxrwxrwx  1 root root    9 10月 17 21:22 man -> share/man/
drwxr-xr-x  2 root root 4096 3月   1  2018 sbin/
drwxr-xr-x  8 root root 4096 3月   1  2018 share/
drwxr-xr-x  2 root root 4096 3月   1  2018 src/
yongqiang@DN-S3:~$ 

 

yongqiang@DN-S3:~$ sudo gedit /etc/profile
[sudo] yongqiang 的密码: 

(gedit:8705): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files

** (gedit:8705): WARNING **: Set document metadata failed: 不支持设置属性 metadata::gedit-spell-enabled

** (gedit:8705): WARNING **: Set document metadata failed: 不支持设置属性 metadata::gedit-encoding

** (gedit:8705): WARNING **: Set document metadata failed: 不支持设置属性 metadata::gedit-position
yongqiang@DN-S3:~$ 
yongqiang@DN-S3:~$ sudo cat /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "$PS1" ]; then
  if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi

# foreverstrong
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
yongqiang@DN-S3:~$ 
yongqiang@DN-S3:~$ nvcc -V
程序“nvcc”尚未安装。 您可以使用以下命令安装:
sudo apt install nvidia-cuda-toolkit
yongqiang@DN-S3:~$ 
yongqiang@DN-S3:~$ . /etc/profile
yongqiang@DN-S3:~$ 
yongqiang@DN-S3:~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176
yongqiang@DN-S3:~$ 

4.3. . /etc/profile
yongqiang@DN-S3:~/darknet_work/darknet_180606/darknet$ . /etc/profile
yongqiang@DN-S3:~/darknet_work/darknet_180606/darknet$
其中 . 和 /etc/profile 之间有空格

4.4. source /etc/profile
yongqiang@DN-S3:~/darknet_work/darknet_180606/darknet$ source /etc/profile
yongqiang@DN-S3:~/darknet_work/darknet_180606/darknet$
建议 Log Out 之后重新登录帐户。

5. 重新编译成功
yongqiang@DN-S3:~/darknet_work/darknet_180606/darknet$ make clean
yongqiang@DN-S3:~/darknet_work/darknet_180606/darknet$ make

 

你可能感兴趣的:(CUDA,-,cuDNN,Darknet)