【问题标题】:How to pip install mtcnn on Ubunutu如何在 Ubuntu 上 pip 安装 mtcnn
【发布时间】:2021-02-09 22:15:35
【问题描述】:

我正在尝试从 pip 安装这个库:

https://github.com/ipazc/mtcnn

当我运行建议的命令时,我收到此错误:

$ pip3 install mtcnn


Collecting mtcnn
  Downloading https://files.pythonhosted.org/packages/67/43/abee91792797c609c1bf30f1112117f7a87a713ebaa6ec5201d5555a73ef/mtcnn-0.1.0-py3-none-any.whl (2.3MB)
    100% |████████████████████████████████| 2.3MB 604kB/s 
Collecting opencv-python>=4.1.0 (from mtcnn)
  Using cached https://files.pythonhosted.org/packages/bb/08/9dbc183a3ac6baa95fabf749ddb531bd26256edfff5b6c2195eca26258e9/opencv-python-4.5.1.48.tar.gz
Collecting keras>=2.0.0 (from mtcnn)
  Downloading https://files.pythonhosted.org/packages/44/e1/dc0757b20b56c980b5553c1b5c4c32d378c7055ab7bfa92006801ad359ab/Keras-2.4.3-py2.py3-none-any.whl
Collecting numpy>=1.13.3 (from opencv-python>=4.1.0->mtcnn)
  Using cached https://files.pythonhosted.org/packages/45/b2/6c7545bb7a38754d63048c7696804a0d947328125d81bf12beaa692c3ae3/numpy-1.19.5-cp36-cp36m-manylinux1_x86_64.whl
Collecting pyyaml (from keras>=2.0.0->mtcnn)
  Downloading https://files.pythonhosted.org/packages/7a/5b/bc0b5ab38247bba158504a410112b6c03f153c652734ece1849749e5f518/PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl (640kB)
    100% |████████████████████████████████| 645kB 2.1MB/s 
Collecting scipy>=0.14 (from keras>=2.0.0->mtcnn)
  Using cached https://files.pythonhosted.org/packages/c8/89/63171228d5ced148f5ced50305c89e8576ffc695a90b58fe5bb602b910c2/scipy-1.5.4-cp36-cp36m-manylinux1_x86_64.whl
Collecting h5py (from keras>=2.0.0->mtcnn)
  Downloading https://files.pythonhosted.org/packages/70/7a/e53e500335afb6b1aade11227cdf107fca54106a1dca5c9d13242a043f3b/h5py-3.1.0-cp36-cp36m-manylinux1_x86_64.whl (4.0MB)
    100% |████████████████████████████████| 4.0MB 362kB/s 
Collecting cached-property; python_version < "3.8" (from h5py->keras>=2.0.0->mtcnn)
  Downloading https://files.pythonhosted.org/packages/48/19/f2090f7dad41e225c7f2326e4cfe6fff49e57dedb5b53636c9551f86b069/cached_property-1.5.2-py2.py3-none-any.whl
Building wheels for collected packages: opencv-python
  Running setup.py bdist_wheel for opencv-python ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dzjs1nf_/opencv-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmplsl7vw2mpip-wheel- --python-tag cp36:
  Traceback (most recent call last):
    File "/home/ubuntu/.local/lib/python3.6/site-packages/skbuild/setuptools_wrap.py", line 560, in setup
      cmkr = cmaker.CMaker(cmake_executable)
    File "/home/ubuntu/.local/lib/python3.6/site-packages/skbuild/cmaker.py", line 95, in __init__
      self.cmake_version = get_cmake_version(self.cmake_executable)
    File "/home/ubuntu/.local/lib/python3.6/site-packages/skbuild/cmaker.py", line 82, in get_cmake_version
      "Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable)
  
  Problem with the CMake installation, aborting build. CMake executable is cmake
  
  ----------------------------------------
  Failed building wheel for opencv-python
  Running setup.py clean for opencv-python
Failed to build opencv-python
Installing collected packages: numpy, opencv-python, pyyaml, scipy, cached-property, h5py, keras, mtcnn
  Running setup.py install for opencv-python ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dzjs1nf_/opencv-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-hs7o4egq-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    Traceback (most recent call last):
      File "/home/ubuntu/.local/lib/python3.6/site-packages/skbuild/setuptools_wrap.py", line 560, in setup
        cmkr = cmaker.CMaker(cmake_executable)
      File "/home/ubuntu/.local/lib/python3.6/site-packages/skbuild/cmaker.py", line 95, in __init__
        self.cmake_version = get_cmake_version(self.cmake_executable)
      File "/home/ubuntu/.local/lib/python3.6/site-packages/skbuild/cmaker.py", line 82, in get_cmake_version
        "Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable)
    
    Problem with the CMake installation, aborting build. CMake executable is cmake
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dzjs1nf_/opencv-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-hs7o4egq-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-dzjs1nf_/opencv-python/

我在尝试pip install opencv-python 时遇到了同样的错误。但是,我通过成功运行sudo apt install python3-opencv 解决了这个问题。 mtcnn 软件包尝试使用失败的 pip 方法重新安装 opencv。我该如何解决这个问题?

我使用的是 aws ec2 ubuntu 18.04。

【问题讨论】:

  • cmake 安装了吗?
  • 请尝试使用新的 18.04 实例。我试过pip3 install mtcnn,它没有任何问题。
  • 确保您使用的是正确版本的 cmake
  • @Marcin 我尝试了同样的错误。你的过程是什么?我不得不安装 pip 和 scikit-build,然后我得到了同样的错误。
  • @Abhi25t 我应该使用什么版本?我运行了这个命令sudo apt install cmake,现在有了cmake version 3.10.2。现在pip3 install mtcnn 永远落后于Building wheels for collected packages: opencv-python Running setup.py bdist_wheel for opencv-python ... |

标签: amazon-web-services ubuntu amazon-ec2 computer-vision cv2


【解决方案1】:

首先安装Cmake

pip install cmake

pip3 install cmake

然后安装mtcnn

pip install mtcnn

【讨论】:

    猜你喜欢
    • 2020-09-30
    • 1970-01-01
    • 2019-07-01
    • 2022-11-15
    • 2021-04-15
    • 2017-07-28
    • 2019-07-05
    • 2021-05-06
    • 2020-12-16
    相关资源
    最近更新 更多