【问题标题】:Cannot install python package due to cmake error由于 cmake 错误,无法安装 python 包
【发布时间】:2020-06-16 01:38:16
【问题描述】:

我正在尝试通过在终端中执行 pip install disptools 来安装 disptools 包。 disptools 包在此处链接https://github.com/m-pilia/disptools。 它在安装过程中给了我一个很长的错误消息,下面显示了主要错误。

Building wheel for disptools (setup.py) ... error
ERROR: Command errored out with exit status 1:

...

CMake Error:

Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)`

它还包含在错误中:

File "/Users/name/anaconda3/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/private/var/folders/6p/16591qb93vs76dysmldcz8140000gn/T/pip-install-vn5twf6v/disptools', '-DDISPTOOLS_DEBUG=OFF', '-DDISPTOOLS_OPT=OFF', '-DDISPTOOLS_VERBOSE=ON', '-DDISPTOOLS_LOW_ORDER_PD=OFF', '-DDISPTOOLS_DOUBLE=OFF', '-DDISPTOOLS_CUDA_SUPPORT=OFF', '-DDISPTOOLS_CUDA_ERROR_CHECK=ON', '-DDISPTOOLS_CUDA_ERROR_CHECK_SYNC=ON', '-DDISPTOOLS_PYTHON_SUPPORT=ON', '-DDISPTOOLS_PYTHON_C_MODULE_NAME=_disptools', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=/private/var/folders/6p/16591qb93vs76dysmldcz8140000gn/T/pip-install-vn5twf6v/disptools/build/lib.macosx-10.9-x86_64-3.6', '-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE=build/temp.macosx-10.9-x86_64-3.6', '-DPYTHON_EXECUTABLE=/Users/name/anaconda3/bin/python3']' 
returned non-zero exit status 1.

我在网上到处找,但我真的找不到任何有用的资源来解决这个问题。 如果有人可以提供帮助,将不胜感激。

【问题讨论】:

  • 为什么不使用pip 为您安装呢? python -m pip install disptools
  • 我试过python -m pip install disptools,但它给出了同样的错误

标签: python cmake pip


【解决方案1】:

使用命令,python -m pip install disptools 你尝试下载、编译和安装disptools

编译步骤失败并出现CMake 错误,表明它未能找到库OpenMP。您可以使用

将它安装在 Ubuntu/Debian 发行版上
sudo apt install libomp-dev

之后,您可以再次启动pip 命令。

希望你能满足所有编译要求。

【讨论】:

  • 如果在 MacOS 上出现同样的错误,那么你必须以 brew 为例来安装 openmp
  • 我确实 brew install libomp 并解决了错误。之后出现了另一个错误,我不知道如何解决它。 ld:未找到架构 x86_64 的符号 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
【解决方案2】:

如果您使用 Anaconda Prompt(推荐),

conda install -c conda-forge dlib

【讨论】:

    猜你喜欢
    • 2021-02-09
    • 2017-10-10
    • 1970-01-01
    • 2021-11-16
    • 2017-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-09
    相关资源
    最近更新 更多