1. 程式人生 > 其它 >Linux arm環境下pip3安裝av失敗

Linux arm環境下pip3安裝av失敗

報如下錯誤:
Could not find libavformat with pkg-config.
Could not find libavcodec with pkg-config.
Could not find libavdevice with pkg-config.
Could not find libavutil with pkg-config.
Could not find libavfilter with pkg-config.
Could not find libswscale with pkg-config.
Could not find libswresample with pkg-config.


可以對應安裝apt-get install libavformat-dev 等庫

如果編譯錯誤,可以嘗試:

root使用者下安裝步驟:
安裝ffmpeg

mkdir ffmpeg
wget http://www.ffmpeg.org/releases/ffmpeg-4.1.3.tar.gz
tar -zxvf ffmpeg-4.1.3.tar.gz
cd ffmpeg-4.1.3
./configure --enable-shared --enable-pic --enable-static --disable-x86asm --prefix=/root/yuefu/ffmpeg        #其中/root/yuefu/ffmpeg換成自己要安裝的路徑
make -j32
make install

vi /etc/ld.so.conf.d/ffmpeg.conf
在末尾新增一行,路徑換成自己的
/root/yuefu/ffmpeg/lib
使配置生效
ldconfig

配置profile系統檔案
vim /etc/profile
在末尾新增一行
export PATH=$PATH:/root/yuefu/ffmpeg/bin
使配置檔案生效
source /etc/profile
使opencv能找到ffmpeg
pip3 install opencv-python
cp /root/yuefu/ffmpeg/lib/pkgconfig/* /usr/share/pkgconfig

安裝pyav

git clone https://gitee.com/mirrors/PyAV.git
cd PyAV/
python3 setup.py build --ffmpeg-dir=/root/yuefu/ffmpeg
python3 setup.py install
點選複製

測試pyav安裝是否成功
cd ..
python3
import av
注意:不要再PyAv目錄下測試,否則報錯
ModuleNotFoundError: No module named 'av._core'

聯絡方式:emhhbmdfbGlhbmcxOTkxQDEyNi5jb20=