我使用pip install -r requests.txt安装项目所需依赖,由于未在requirements.txt中指定版本,导致pip自动安装了不兼容的版本,导致报错
chen_shuhan@mycomputer:~/Desktop/python_rotaeno_stabilizer-master$ python3 -m venv .venv
chen_shuhan@mycomputer:~/Desktop/python_rotaeno_stabilizer-master$ source .venv/bin/activate
(.venv) chen_shuhan@mycomputer:~/Desktop/python_rotaeno_stabilizer-master$ pip install -r '/home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/requirements.txt'
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting mpmath==1.3.0 (from -r /home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/requirements.txt (line 1))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/43/e3/7d92a15f894aa0c9c4b49b8ee9ac9850d6e63b03c9c32c0367a13ae62209/mpmath-1.3.0-py3-none-any.whl (536 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 536.2/536.2 kB 3.6 MB/s eta 0:00:00
Collecting numpy (from -r /home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/requirements.txt (line 2))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/f9/58/30a85127bfee6f108282107caf8e06a1f0cc997cb6b52cdee699276fcce4/numpy-2.3.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (16.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.6/16.6 MB 54.6 MB/s eta 0:00:00
Collecting opencv-contrib-python==4.8.1.78 (from -r /home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/requirements.txt (line 3))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/32/9e/4dcc0bb70e3b365dc85b8f96c63e6a306653f7cc6ed061aa6cc7b2bddee7/opencv_contrib_python-4.8.1.78-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (67.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 67.8/67.8 MB 13.2 MB/s eta 0:00:00
Collecting opencv-python==4.8.1.78 (from -r /home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/requirements.txt (line 4))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/b7/8a/b2f7e1a434d56bf1d7570fc5941ace0847404e1032d7f1f0b8fed896568d/opencv_python-4.8.1.78-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (61.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.7/61.7 MB 17.4 MB/s eta 0:00:00
Collecting Pillow==10.0.1 (from -r /home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/requirements.txt (line 5))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/0c/ce/3cceae2fab54118a5fcdfd9a2ddd0167c21169446c05378c5dc10b0d5093/Pillow-10.0.1-cp312-cp312-manylinux_2_28_x86_64.whl (3.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.6/3.6 MB 85.7 MB/s eta 0:00:00
Collecting psutil==5.9.6 (from -r /home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/requirements.txt (line 6))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/19/06/4e3fa3c1b79271e933c5ddbad3a48aa2c3d5f592a0fb7c037f3e0f619f4d/psutil-5.9.6-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (283 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 283.6/283.6 kB 46.0 MB/s eta 0:00:00
Collecting tqdm==4.66.1 (from -r /home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/requirements.txt (line 7))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/00/e5/f12a80907d0884e6dff9c16d0c0114d81b8cd07dc3ae54c5e962cc83037e/tqdm-4.66.1-py3-none-any.whl (78 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.3/78.3 kB 19.4 MB/s eta 0:00:00
Installing collected packages: mpmath, tqdm, psutil, Pillow, numpy, opencv-python, opencv-contrib-python
Successfully installed Pillow-10.0.1 mpmath-1.3.0 numpy-2.3.4 opencv-contrib-python-4.8.1.78 opencv-python-4.8.1.78 psutil-5.9.6 tqdm-4.66.1
(.venv) chen_shuhan@mycomputer:~/Desktop/python_rotaeno_stabilizer-master$ python3 main.py
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.3.4 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
Traceback (most recent call last): File "/home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/main.py", line 5, in <module>
from python_rotaeno_stabilizer import RotaenoStabilizer
File "/home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/python_rotaeno_stabilizer.py", line 9, in <module>
import cv2
File "/home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/.venv/lib/python3.12/site-packages/cv2/__init__.py", line 181, in <module>
bootstrap()
File "/home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/.venv/lib/python3.12/site-packages/cv2/__init__.py", line 153, in bootstrap
native_module = importlib.import_module("cv2")
File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
AttributeError: _ARRAY_API not found
Traceback (most recent call last):
File "/home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/main.py", line 5, in <module>
from python_rotaeno_stabilizer import RotaenoStabilizer
File "/home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/python_rotaeno_stabilizer.py", line 9, in <module>
import cv2
File "/home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/.venv/lib/python3.12/site-packages/cv2/__init__.py", line 181, in <module>
bootstrap()
File "/home/chen_shuhan/Desktop/python_rotaeno_stabilizer-master/.venv/lib/python3.12/site-packages/cv2/__init__.py", line 153, in bootstrap
native_module = importlib.import_module("cv2")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: numpy.core.multiarray failed to import
(.venv) chen_shuhan@mycomputer:~/Desktop/python_rotaeno_stabilizer-master$ pip uninstall numpy -y
Found existing installation: numpy 2.3.4
Uninstalling numpy-2.3.4:
Successfully uninstalled numpy-2.3.4
(.venv) chen_shuhan@mycomputer:~/Desktop/python_rotaeno_stabilizer-master$ pip install numpy==1.26.4
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting numpy==1.26.4
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/0f/50/de23fde84e45f5c4fda2488c759b69990fd4512387a8632860f3ac9cd225/numpy-1.26.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.0/18.0 MB 44.9 MB/s eta 0:00:00
Installing collected packages: numpy
Successfully installed numpy-1.26.4
(.venv) chen_shuhan@mycomputer:~/Desktop/python_rotaeno_stabilizer-master$ python3 main.py
['Screenrecording_20251108_082111_com.xd.rotaeno.tapcn.mp4']
正在处理: Screenrecording_20251108_082111_com.xd.rotaeno.tapcn.mp4
正在将视频转换为CFR视频……
我使用pip install -r requests.txt安装项目所需依赖,由于未在requirements.txt中指定版本,导致pip自动安装了不兼容的版本,导致报错
终端输出
创建虚拟环境及安装依赖
尝试运行报错
指定 numpy==1.26.4 重新安装
启动成功
建议:在requests.txt中指定依赖的版本