jetson nano——編譯安裝opencv==4.4

目錄

  • 1.下載源碼,我提供的鏈接如下:
    • 1.1文件上傳的路徑位置,注意ymck是我自己的用戶名(你們自己換成你們自己相對應的就行)
  • 2.解壓文件
  • 3.安裝依賴
  • 4.增加swap交換內存
    • 4.1臨時增加交換內存swap
    • 4.2永久增加swap
  • 5.安裝opencv4.4(里面是有contrib這個的)
    • 5.1創建目錄
    • 5.2安裝配置cmake選項
    • 5.3編譯!!一定要增大swap否則會報錯!!!!!
      • 5.3.1報錯,一條cuda,一條內存不足,導致報錯,所以大家一定要增大swap交換內存!!!!!!!!!!!,
      • 5.3.2解決問題
    • 5.4開始安裝
    • 5.4.1waning解釋,這是對開發者的一個警告,對咱們來說沒啥問題我解釋一下
  • 6.復制編譯過程中的文件到自己在虛擬環境中的dist-packages,這樣你就可以導入這個cv2了
  • 7.查看opencv版本
  • 8.安裝過程

系統:jetson-nano-jp451-sd-card-image
ubuntu 18.04

(總共編譯得2-3個多小時,大家耐心吧,時間相較于其它的已經很短了)
注意:!!make -j8以后千萬別在動了,還有就是開始前把那些后臺啥的都關掉,千萬別在make -j8期間操作,要不然報錯。

ps:如果你們編譯其它的版本,我在這提供11個文件,你們得放到/opencv-contrib/modules/xfeatures2d/src/這個里面。
你們還得下載opencv和opencv-contrib的包,官網給你們放著,編譯步驟參考我這個原理是一樣的,得注意,他們兩個的版本應該一樣的。
官網:https://github.com/opencv/
鏈接:https://pan.baidu.com/s/1Jcu6g80qlp-5A3FrZ6VO8Q?pwd=0lzt
提取碼:0lzt

在這里插入圖片描述

1.下載源碼,我提供的鏈接如下:

鏈接:https://pan.baidu.com/s/1QsrI67HmHXV59k6RetSMUQ?pwd=55d4
提取碼:55d4

1.1文件上傳的路徑位置,注意ymck是我自己的用戶名(你們自己換成你們自己相對應的就行)

在這里插入圖片描述

2.解壓文件

unzip opencv4.4.zip

3.安裝依賴

#1.
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple scikit-build==0.11.1
##注意,必須是這個版本,否則會報錯,調試好久。。。#里面有些處理視頻和圖像的我就不在這單獨說明了
#2.
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
#3.
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
#4.    
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev
#5.    
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
#6.    
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
#7.
sudo apt-get install cmake libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg-dev libpng-dev libtiff-dev libtiff5-dev libswscale-dev libcurl4-openssl-dev libtbb2 libdc1394-22-dev

4.增加swap交換內存

下面這個swap可以操作,也可以不操作,最好選一個吧。

4.1臨時增加交換內存swap

sudo fallocate -l 4G /var/swapfile
sudo chmod 600 /var/swapfile #600是root權限,644是普通用戶也行
sudo mkswap /var/swapfile
sudo swapon /var/swapfile

4.2永久增加swap

sudo fallocate -l 4G /var/swapfile
sudo chmod 600 /var/swapfile
sudo mkswap /var/swapfile
sudo swapon /var/swapfile
sudo bash -c 'echo "/var/swapfile swap swap defaults 0 0" >> /etc/fstab'

5.安裝opencv4.4(里面是有contrib這個的)

5.1創建目錄

#1.
cd opencv4.4/opencv-4.4.0/
#2.
mkdir build
#3.
cd build

5.2安裝配置cmake選項

注意,里面ymck是我的用戶名,大家自行修改,換成你們自己的!

cmake \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_TESTS=OFF \
-D WITH_FFMPEG=ON \
-D WITH_GSTREAMER=ON \
-D WITH_V4L=ON \
-D WITH_OPENEXR=OFF \
-D CUDA_ARCH_BIN=5.3 \
-D CUDA_ARCH_PTX="" \
-D CMAKE_CXX_FLAGS="-W -Wall -Werror=return-type" \
-D BUILD_PNG=ON \
-D BUILD_TIFF=ON \
-D BUILD_TBB=OFF \
-D BUILD_JPEG=ON \
-D BUILD_JASPER=OFF \
-D BUILD_ZLIB=OFF \
-D BUILD_EXAMPLES=OFF \
-D BUILD_opencv_java=OFF \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D ENABLE_PRECOMPILED_HEADERS=OFF \
-D WITH_OPENCL=OFF \
-D WITH_OPENMP=OFF \
-D WITH_GSTREAMER_0_10=OFF \
-D WITH_CUDA=ON \
-D WITH_GTK=ON \
-D WITH_VTK=OFF \
-D WITH_1394=OFF \
-D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.2 \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_EXTRA_MODULES_PATH=/home/ymck/opencv4.4/opencv_contrib-4.4.0/modules \
-D PYTHON3_EXECUTABLE=/home/ymck/archiconda3/envs/dc39/bin/python \
-D PYTHON3_INCLUDE_DIR=/home/ymck/archiconda3/envs/dc39/include/python3.9 \
-D PYTHON_DEFAULT_EXECUTABLE=$(which python3) \
-D PYTHON3_LIBRARY=/home/ymck/archiconda3/envs/dc39/lib/libpython3.9.so \
..

大家可以看我的結果(如果buidl目錄被玩壞了,可以新建一個其它的在進行cmake,我把這個結果放到最后面:),大家往下看,一定這幾個得出現,要不然弄了可能找不到opencv4.4,雖然不報錯也能安裝成功,但是你導入cv2,會報錯,而且你也找不到這個包,which python你們可以用這個代碼查找相應的路徑,一般和我這個路徑差不多

#####################################
#這里面的代碼不是運行的
#這里面的代碼是讓你們對照自己的camke是否正確的
--   Python 3:
--     Interpreter:                 /home/ymck/archiconda3/envs/dc39/bin/python (ver 3.9.13)
--     Libraries:                   /home/ymck/archiconda3/envs/dc39/lib/libpython3.9.so (ver 3.9.13)
--     numpy:                       /home/ymck/archiconda3/envs/dc39/lib/python3.9/site-packages/numpy/core/include (ver 1.26.4)
--     install path:                lib/python3.9/site-packages/cv2/python-3.9
-- 
--   Python (for build):            /home/ymck/archiconda3/envs/dc39/bin/python3
#####################################

5.3編譯!!一定要增大swap否則會報錯!!!!!

make -j8

在這里插入圖片描述
在這里插入圖片描述

5.3.1報錯,一條cuda,一條內存不足,導致報錯,所以大家一定要增大swap交換內存!!!!!!!!!!!,

在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述

5.3.2解決問題

增大swap,之前是1.9G,現在是5.9G,reboot以后即可恢復
在這里插入圖片描述

現在未報錯,可以看到swap的確跑到2.5G了,說明的確有點費swap
在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述

5.4開始安裝

sudo make install

運行結果如下:
在這里插入圖片描述
在這里插入圖片描述

5.4.1waning解釋,這是對開發者的一個警告,對咱們來說沒啥問題我解釋一下

CMake提醒開發者,它默認的FindCUDA模塊已經被移除,會影響到之前依賴這個模塊的構建腳本。這不會影響到項目的構建過程,只是作為一個提醒開發者進行代碼維護的提示。

6.復制編譯過程中的文件到自己在虛擬環境中的dist-packages,這樣你就可以導入這個cv2了

這個python中的python3.9就是你編譯過程中產生的
在這里插入圖片描述
在這里插入圖片描述

cp /usr/local/lib/python3.9/site-packages/cv2/python-3.9/cv2.cpython-39-aarch64-linux-gnu.so /home/ymck/archiconda3/envs/dc39/lib/python3.9/site-packages/

復制完成以后結果如下:
在這里插入圖片描述

7.查看opencv版本

#1.
python
#2.
import cv2
#3.
print(cv2.__version__)

在這里插入圖片描述

到這就說明大家成功編譯完成啦,祝大家都成功呀!!!

8.安裝過程

如下圖:

大家可以看我的結果(如果buidl目錄被玩壞了,可以新建一個其它的在進行cmake,我把這個結果放到最后面:

#這個是cmake以后的輸出的結果:
# 大家可以自己對照一下,有些實在安裝不上(java啥的,比較ubuntu18實在太老了。
#如果你們用的版本高,你們運行前面安裝依賴的話,應該不會出現我下面這些no found。
#還有就是,一些warning,因為我升級了cmake版本,這些對咱們沒啥影響,#warning不影響,那些warning是對開發者的一些提醒,遇見了不用在意。
-- CUDA detected: 10.2
-- CUDA: Using CUDA_ARCH_BIN=5.3
-- CUDA NVCC target flags: -gencode;arch=compute_53,code=sm_53;-D_FORCE_INLINES
-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR Atlas_CBLAS_LIBRARY Atlas_BLAS_LIBRARY) 
-- Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 AWT JVM) 
CMake Deprecation Warning at 3rdparty/carotene/hal/CMakeLists.txt:1 (cmake_minimum_required):Compatibility with CMake < 3.5 will be removed from a future version ofCMake.Update the VERSION argument <min> value or use a ...<max> suffix to tellCMake that the project does not need compatibility with older versions.CMake Deprecation Warning at 3rdparty/carotene/CMakeLists.txt:1 (cmake_minimum_required):Compatibility with CMake < 3.5 will be removed from a future version ofCMake.Update the VERSION argument <min> value or use a ...<max> suffix to tellCMake that the project does not need compatibility with older versions.-- OpenCV Python: during development append to PYTHONPATH: /home/ymck/opencv4.4/opencv-4.4.0/build1/python_loader
-- Caffe:   NO
-- Protobuf:   NO
-- Glog:   NO
-- freetype2:   YES (ver 21.0.15)
-- harfbuzz:    YES (ver 1.7.2)
-- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS) (found version "")
-- Julia not found. Not compiling Julia Bindings. 
-- Module opencv_ovis disabled because OGRE3D was not found
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
-- Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
-- Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
-- Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
-- Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags
-- Checking for module 'tesseract'
--   No package 'tesseract' found
-- Tesseract:   NO
-- Allocator metrics storage type: 'int'
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.sse2.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.sse3.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.ssse3.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.sse4_1.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.sse4_2.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.avx.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.avx2.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.avx512_skx.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin256.avx2.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin256.avx512_skx.cpp
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin512.avx512_skx.cpp
-- Excluding from source files list: modules/imgproc/src/corner.avx.cpp
-- Excluding from source files list: modules/imgproc/src/imgwarp.avx2.cpp
-- Excluding from source files list: modules/imgproc/src/imgwarp.sse4_1.cpp
-- Excluding from source files list: modules/imgproc/src/resize.avx2.cpp
-- Excluding from source files list: modules/imgproc/src/resize.sse4_1.cpp
-- Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': /home/ymck/opencv4.4/opencv-4.4.0/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
-- opencv_dnn: filter out ocl4dnn source code
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx2.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx512_skx.cpp
-- Excluding from source files list: modules/features2d/src/fast.avx2.cpp
-- 
-- General configuration for OpenCV 4.4.0 =====================================
--   Version control:               unknown
-- 
--   Extra modules:
--     Location (extra):            /home/ymck/opencv4.4/opencv_contrib-4.4.0/modules
--     Version control (extra):     unknown
-- 
--   Platform:
--     Timestamp:                   2024-03-03T06:54:55Z
--     Host:                        Linux 4.9.201-tegra aarch64
--     CMake:                       3.28.3
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
-- 
--   CPU/HW features:
--     Baseline:                    NEON FP16
--       required:                  NEON
--       disabled:                  VFPV3
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ standard:                11
--     C++ Compiler:                /usr/bin/c++  (ver 7.5.0)
--     C++ flags (Release):         -W -Wall -Werror=return-type   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -W -Wall -Werror=return-type   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /usr/bin/cc
--     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):      -Wl,--gc-sections -Wl,--as-needed  
--     Linker flags (Debug):        -Wl,--gc-sections -Wl,--as-needed  
--     ccache:                      NO
--     Precompiled headers:         NO
--     Extra dependencies:          m pthread cudart_static dl rt nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda-10.2/lib64 -L/usr/lib/aarch64-linux-gnu
--     3rdparty dependencies:
-- 
--   OpenCV modules:
--     To be built:                 alphamat aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    python2 world
--     Disabled by dependency:      -
--     Unavailable:                 cnn_3dobj cvv hdf java js julia matlab ovis sfm viz
--     Applications:                tests perf_tests apps
--     Documentation:               NO
--     Non-free algorithms:         YES
-- 
--   GUI: 
--     GTK+:                        YES (ver 3.22.30)
--       GThread :                  YES (ver 2.56.4)
--       GtkGlExt:                  NO
-- 
--   Media I/O: 
--     ZLib:                        /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)
--     JPEG:                        build-libjpeg-turbo (ver 2.0.5-62)
--     WEBP:                        build (ver encoder: 0x020f)
--     PNG:                         build (ver 1.6.37)
--     TIFF:                        build (ver 42 - 4.0.10)
--     JPEG 2000:                   build Jasper (ver 1.900.1)
--     HDR:                         YES
--     SUNRASTER:                   YES
--     PXM:                         YES
--     PFM:                         YES
-- 
--   Video I/O:
--     FFMPEG:                      YES
--       avcodec:                   YES (57.107.100)
--       avformat:                  YES (57.83.100)
--       avutil:                    YES (55.78.100)
--       swscale:                   YES (4.8.100)
--       avresample:                YES (3.7.0)
--     GStreamer:                   YES (1.14.5)
--     v4l/v4l2:                    YES (linux/videodev2.h)
-- 
--   Parallel framework:            pthreads
-- 
--   Trace:                         YES (with Intel ITT)
-- 
--   Other third-party libraries:
--     Lapack:                      NO
--     Eigen:                       YES (ver 3.3.4)
--     Custom HAL:                  YES (carotene (ver 0.0.1))
--     Protobuf:                    build (3.5.1)
-- 
--   NVIDIA CUDA:                   YES (ver 10.2, CUFFT CUBLAS)
--     NVIDIA GPU arch:             53
--     NVIDIA PTX archs:
-- 
--   cuDNN:                         YES (ver 8.0.0)
-- 
--   Python 3:
--     Interpreter:                 /home/ymck/archiconda3/envs/dc39/bin/python (ver 3.9.13)
--     Libraries:                   /home/ymck/archiconda3/envs/dc39/lib/libpython3.9.so (ver 3.9.13)
--     numpy:                       /home/ymck/archiconda3/envs/dc39/lib/python3.9/site-packages/numpy/core/include (ver 1.26.4)
--     install path:                lib/python3.9/site-packages/cv2/python-3.9
-- 
--   Python (for build):            /home/ymck/archiconda3/envs/dc39/bin/python3
-- 
--   Java:                          
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
-- 
--   Install to:                    /usr/local
-- -----------------------------------------------------------------
-- 
-- Configuring done (13.4s)
-- Generating done (3.2s)
-- Build files have been written to: /home/ymck/opencv4.4/opencv-4.4.0/build1
(dc39) ymck@ymck-desktop:~/opencv4.4/opencv-4.4.0/build1$ 

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/717116.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/717116.shtml
英文地址,請注明出處:http://en.pswp.cn/news/717116.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

2024-03-03 作業

作業要求&#xff1a; 1.使用fwrite、fread將一張隨意的bmp圖片&#xff0c;修改成德國的國旗 2.使用提供的getch函數&#xff0c;編寫一個專門用來輸入密碼的函數&#xff0c;要求輸入密碼的時候&#xff0c;顯示 * 號&#xff0c;輸入回車的時候&#xff0c;密碼輸入結束 作業…

學習Android的第十九天

目錄 Android ExpandableListView 分組列表 ExpandableListView 屬性 ExpandableListView 事件 ExpandableListView 的 Adapter 范例 參考文檔 Android ViewFlipper 翻轉視圖 ViewFlipper 屬性 ViewFlipper 方法 為 ViewFlipper 加入 View 例子&#xff1a;全屏幕可…

【MySQL】索引(重點)-- 詳解

一、索引 沒有索引&#xff0c;可能會有什么問題&#xff1f; 索引 &#xff1a;提高數據庫的性能&#xff0c;索引是物美價廉的東西了。不用加內存&#xff0c;不用改程序&#xff0c;不用調 sql &#xff0c;只要執行正確的 create index &#xff0c;查詢速度就可能提高成…

加密與安全_探索數字證書

文章目錄 Pre概述使用keytool生成證書使用Openssl生成證書 &#xff08;推薦&#xff09;證書的吊銷小結 Pre PKI - 借助Nginx 實現Https 服務端單向認證、服務端客戶端雙向認證 PKI - 04 證書授權頒發機構&#xff08;CA&#xff09; & 數字證書 PKI - 數字簽名與數字證…

java面試題(spring框架篇)(黑馬 )

樹形圖&#xff1a; 一、Spring框架種的單例bean是線程安全嗎&#xff1f; Service Scope("singleton") public class UserServiceImpl implements UserService{ } singleton:bean在每個Spring IOC容器中只有一個實例 protype&#xff1a;一個bean的定義可以有多個…

CPU iowait是什么意思

在linux系統&#xff0c;使用top命令時&#xff0c;可以看到cpu使用統計情況&#xff0c;有時我們會注意到iowait這一項非常高。我們直到&#xff0c;在cpu運行進程、線程時&#xff0c;遇到IO操作&#xff0c;因為IO讀寫通常比較慢&#xff0c;CPU通常可以阻塞線程&#xff0c…

【Web安全靶場】xss-labs-master 1-20

xss-labs-master 其他靶場見專欄 文章目錄 xss-labs-masterlevel-1level-2level-3level-4level-5level-6level-7level-8level-9level-10level-11level-12level-13level-14level-15level-16level-17level-18level-19level-20 level-1 第一關沒有進行任何限制&#xff0c;get請求…

pytorch_神經網絡構建6

文章目錄 強化學習概念實現qLearning基于這個思路,那么解決這個問題的代碼如下 強化學習概念 強化學習有一個非常直觀的表現&#xff0c;就是從出發點到目標之間存在著一個連續的狀態轉換&#xff0c;比如說從狀態一到狀態456&#xff0c;而每一個狀態都有多種的行為&#xff…

全國青少年軟件編程(Python)等級考試試卷(一級) 測試卷2021年12月

第 1 題 【 單選題 】 下面程序的運行結果是什么&#xff1f;&#xff08; &#xff09; a10 b5 ca*b print(c) A :10 B :15 C :50 D :5 正確答案:C 試題解析: 第 2 題 【 單選題 】 與a>b and b>c等價的是&#xff1f;&#xff08; &#xff09; A…

設計模式學習筆記 - 設計原則 - 1.單一職責原則

前言 前面我們提到過 SOLID 原則&#xff0c;實際上 SOLID 由 5 個設計原則組成&#xff0c;分別是&#xff1a;單一職責原則、開閉原則、里氏替換原則、接口隔離原則和依賴反轉原則。它們分別對應 SLOID 中的 S、O、L、I、D 這 5 個英文字母。 今天來學習下 SOLID 原則中的第…

Libevent的使用及reactor模型

Libevent 是一個用C語言編寫的、輕量級的開源高性能事件通知庫&#xff0c;主要有以下幾個亮點&#xff1a;事件驅動&#xff08; event-driven&#xff09;&#xff0c;高性能;輕量級&#xff0c;專注于網絡&#xff0c;不如 ACE 那么臃腫龐大&#xff1b;源代碼相當精煉、易讀…

【Java】Java 中的方法引用寫法

概述 方法引用&#xff08;MethodReference&#xff09;是Lambda表達式的另一種格式&#xff0c;在某些場景下可以提高代碼的可讀性 使用條件 只可以替換單方法的Lambda表達式 什么意思呢 &#xff1f; 例如下面這個Lambda表達式就不可以使用方法引用替換&#xff0c;因為…

100243. 將元素分配到兩個數組中 I

說在前面 &#x1f388;不知道大家對于算法的學習是一個怎樣的心態呢&#xff1f;為了面試還是因為興趣&#xff1f;不管是出于什么原因&#xff0c;算法學習需要持續保持。 題目描述 給你一個下標從 1 開始、包含 不同 整數的數組 nums &#xff0c;數組長度為 n 。 你需要通…

C語言 快速排序——qsort函數的介紹

qsort函數 1. 函數介紹2. 函數使用2.1 整型排序2.2 字符排序2.3 字符串排序2.4 結構體排序 3. 用冒泡思想模擬qsort函數 我們以往使用冒泡排序和選擇排序等對數據進行排序時&#xff0c;有可能會遇到搞不清排序次數&#xff0c;運行時間過長等一些問題&#xff0c;并且這些排序…

aop監控spring cloud接口超時,并記錄到數據庫

引入pom <?xml version"1.0" encoding"UTF-8"?> <project xmlns"http://maven.apache.org/POM/4.0.0" xmlns:xsi"http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation"http://maven.apache.org/POM/4.0.0…

寶塔面板安裝各種組件以及部署應用服務

在linux服務器安裝寶塔面板 一、從寶塔官網下載exe安裝包&#xff0c;安裝命令從寶塔官網&#xff08;https://www.bt.cn/&#xff09;獲取 yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh二、安…

自動駕駛加速落地,激光雷達放量可期(上)

1 激光雷達應用廣泛&#xff0c;汽車有望成最大催化 激光雷達&#xff08;LiDAR&#xff09;是一種主動遙感技術&#xff0c;通過測定傳感器發出的激光在傳感器與目標物體之間的傳播距離&#xff0c;來分析目標地物表面的反射能量大小、反射波譜的幅度、頻率和相位等信息&#…

Vue項目如何進行優化?

Vue項目優化 1.移除控制臺打印2.壓縮圖片3.CDN加速 1.移除控制臺打印 可以使用插件自動去除&#xff0c;插件包括babel-plugin-transform-remove-console、uglifyjs-webpack-plugin、terser-webpack-plugin。最后選擇了terser-webpack-plugin&#xff0c;腳手架vue-cli用這個插…

一文掃盲:訂單管理系統,訂單是公司生命線。

hello&#xff0c;我是貝格前端工場&#xff0c;本期給大家分享訂單管理系統的知識點&#xff0c;歡迎老鐵們點贊、關注&#xff0c;如有需求可以私信我們。 一、什么是訂單管理系統 單管理系統是一種用于管理和處理訂單的軟件系統。它通常用于企業、電子商務平臺、零售店等需…

高并發高可用--反向代理與負載均衡

高并發高可用架構是指能夠應對大量并發請求并保持高度可用的系統架構。為了實現這一目標&#xff0c;通常會采用一系列技術和策略&#xff0c;包括負載均衡、緩存、分布式系統、冗余部署、容錯處理等。 以下是一些構建高并發高可用架構的關鍵要點&#xff1a; 負載均衡&#…