【发布时间】:2021-03-21 15:10:35
【问题描述】:
我尝试在 Apple 芯片 M1 上将 OpenCV 和 Tensorflow 与 Python 结合使用。 我可以使用 Tensorflow,但在我的环境中安装 OpenCV 失败
pip3 install opencv-python
即使我自己在本地构建 opencv-python 在 numpy 上也失败了
git clone https://github.com/skvark/opencv-python.git
cd opencv-python
ENABLE_CONTRIB=0
ENABLE_HEADLESS=1
pip wheel . --verbose
与
错误:命令出错,退出状态为 1: /Users/hannes/git/city-simulator/tensorflow_venv2/bin/python3 /Users/hannes/git/city-simulator/tensorflow_venv2/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/np/7ckckk8s5fd169kvnnfhjkk40000gr/T/pip-build-env-3zg4n104/overlay --no-warn-script-location -v --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.13.3; python_version=='"'"'3.6'"'"' 和 platform_machine != '"'"'aarch64'"'"'' 'numpy==1.19.3; python_version>='"'"'3.6'"'"' 和 sys_platform == '"'"'linux'"'"' 和 platform_machine == '"'"'aarch64'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"' 和 platform_machine != '"'"'aarch64'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' 和 platform_machine != '"'"'aarch64'"'"'' 'numpy==1.19.3; python_version>='"'"'3.9'"'"' 和 platform_machine != '"'"'aarch64'"'"'' 检查日志以获取完整命令 输出。
即使我自己构建 numpy 也失败了
git clone git@github.com:numpy/numpy.git
cd numpy
OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=11.1 python3 -m pip install cython --no-use-pep517
OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=11.1 python3 -m pip install numpy --no-use-pep517
OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=11.1 python3 -m pip install pandas --no-use-pep517
OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=11.1 python3 -m pip install pybind11 --no-use-pep517
OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=11.1 python3 -m pip install scipy --no-use-pep517
brew install libjpeg zlib
python3 -m pip install pillow
python3 -m pip install matplotlib
OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=11.1 python3 -m pip install scikit-learn --no-use-pep517
OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=11.1 python3 -m pip install statsmodels --no-use-pep517
cd ../opencv-python
pip wheel . --verbose
pip install numpy --no-index --find-links file:///Users/hannes/git/city-simulator/numpy/numpy
一切都没有错误,我最后看到了这个
Looking in links: file:///Users/hannes/git/city-simulator/numpy/numpy
Requirement already satisfied: numpy in /Users/hannes/git/city-simulator/tensorflow_venv2/lib/python3.8/site-packages (1.18.5)
和pip wheel . --verbose 仍然遇到同样的错误????
【问题讨论】:
标签: python tensorflow opencv apple-m1