首页 > 解决方案 > 错误:无法为使用 PEP 517 且无法直接安装的 cvxpy 构建轮子

问题描述

我在安装 CVXPY 时遇到了以下问题,我还下载了最新版本的 Visual Studio,但似乎也无法正常工作。

    >       C:\Anaconda3\lib\site-packages\numpy\distutils\system_info.py:1730:
    > UserWarning:
    >           Lapack (http://www.netlib.org/lapack/) sources not found.
    >           Directories to search for the sources can be specified in the
    >           numpy/distutils/site.cfg file (section [lapack_src]) or by setting
    >           the LAPACK_SRC environment variable.
    >         return getattr(self, '_calc_info_{}'.format(name))()
    >       error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio":
    > https://visualstudio.microsoft.com/downloads/
    >       {}
    >       {}
    >       ----------------------------------------
    >       ERROR: Failed building wheel for scs
    >       Running setup.py clean for scs
    >     Failed to build cvxpy ecos scs
    >     ERROR: Could not build wheels for cvxpy which use PEP 517 and cannot be installed directly

标签: pythonvisual-studiocvxpy

解决方案


我遇到了同样的问题。我必须创建一个新环境并安装它才能工作。转到 Anaconda Prompt,然后执行以下操作:

  1. conda create your_env_name
  2. conda activate your_env_name
  3. conda install -c conda-forge cvxpy
  4. conda install spyder

我在工作中使用 Spyder。我必须像第 4 步一样在新环境中安装 Spyder。我找不到解决方法来使用现有的 Spyder 在这两种环境下工作。


推荐阅读