我正在尝试在自己的主目录中编译并安装OpenCV(以便可以安装多个版本)
我打电话给cmak时有这个选项:
-D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/mans/local/opencv -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_INF_ENGINE=ON -D ENABLE_CXX11=ON
但是当我构建代码并尝试安装它时,出现此错误:
-- Install configuration: "Release"
CMake Error at cmake_install.cmake:41 (file):
file cannot create directory: /usr/local/share/licenses/opencv4. Maybe
need administrative privileges.
Makefile:61: recipe for target 'install' failed
make: *** [install] Error 1
由于要安装在主目录中,因此无法使用
sudo make install
因为它将在根目录上安装openCV,所以我不想这样做。
我正在使用此bash脚本从git存储库中构建和安装OpenCV。
WITH_INF_ENGINE=true # should be buildwith Intel Inference Engineen
workingDir="$HOME/local"
downloadDir="$workingDir/downloadedFiles"
if [ ! -d "$workingDir" ]; then
mkdir "$workingDir"
fi
cd $workingDir
git clone https://github.com/opencv/opencv $downloadDir/opencv
cd $downloadDir/opencv
mkdir build
cd build
cmakeParameters="-D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=$workingDir/opencv -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON "
if $WITH_INF_ENGINE; then
source /opt/intel/computer_vision_sdk/bin/setupvars.sh
cmakeParameters="$cmakeParameters -D WITH_INF_ENGINE=ON -D ENABLE_CXX11=ON"
fi
echo "$cmakeParameters"
cmake "$cmakeParameters" ..
make -j $(nproc)
make install