【问题标题】:Cannot install cvxpy with python 3.8无法使用 python 3.8 安装 cvxpy
【发布时间】:2020-02-18 09:18:27
【问题描述】:

我已经尝试为 python 安装 cvxpy (https://www.cvxpy.org/install/)。我在所有项目中都使用 Python 3.8,并且不喜欢在使用 3.7 的地方制作虚拟环境。有没有人修复在 python 3.8 上使用 cvxpy(我使用的是 windows)?

谢谢!

ERROR: Command errored out with exit status 1:
ommand: 'AppData\Local\Programs\Python\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'AppData\\Local\\Temp\\pip-install-kehvj2di\\osqp\\setup.py'"'"'; __file__='"'"'AppData\\Local\\Temp\\pip-install-kehvj2di\\osqp\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'AppData\Local\Temp\pip-record-1u4al7gt\install-record.txt' --single-version-externally-managed --compile
cwd: AppData\Local\Temp\pip-install-kehvj2di\osqp\

-- Selecting Windows SDK version  to target Windows 10.0.18362.
    CMake Error at CMakeLists.txt:5 (project):
      Failed to run MSBuild command:

        MSBuild.exe

      to get the value of VCTargetsPath:

        The system cannot find the file specified



    -- Configuring incomplete, errors occurred!
    See also "AppData/Local/Temp/pip-install-kehvj2di/osqp/osqp_sources/build/CMakeFiles/CMakeOutput.log".
    The system cannot find the file specified
    CMake Error: Generator: execution of make failed. Make command was: MSBuild.exe osqpstatic.vcxproj /p:Configuration=Release /p:Platform=x64 /p:VisualStudioVersion=14.0 /v:m &&
    error: [Errno 2] No such file or directory: 'osqp_sources\\build\\out\\Release\\osqp.lib'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'AppData\Local\Programs\Python\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'Local\\Temp\\pip-install-kehvj2di\\osqp\\setup.py'"'"'; __file__='"'"'AppData\\Local\\Temp\\pip-install-kehvj2di\\osqp\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'AppData\Local\Temp\pip-record-1u4al7gt\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

【问题讨论】:

  • 你能发布你遇到的错误吗?
  • 完成了,忘记了。
  • 请注意,您也可以从here 下载并安装whl 文件,但正确设置您的构建工具仍然值得一试

标签: python pip cvxpy


【解决方案1】:

您的问题似乎不是 Python 版本,而是缺少构建工具。安装 Microsoft Visual Build Tools 并确保它们在 PATH 上(以便 conda 可以执行 MSBuild.exe)。

cvxpy 构建工具installation instructions(在pptx 中)。

【讨论】:

  • 我的安装方式与使用 Python 3.7 的同事完全相同,您建议如何将它们放在 PATH 上?
  • 你是如何安装它们的?您是否使用 cvxpy 文档中的链接下载它们?
  • 是的,我用过那个,但之前我也做过visual studio 2019,你也可以在其中获得构建工具。 cvxpy 说:CVXPY 具有以下依赖项:Python 2.7、3.4、3.5、3.6 或 3.7。
  • @Bart 你能检查一下MSBuild.exe 是否在你的路径上吗?你可以从命令行执行它吗? cvxpy 需要 Python 3.5 或更高版本 github.com/cvxgrp/cvxpy/blob/master/setup.py#L71 README 具有误导性。
  • 所以我把它放在我的路上,但它仍然不起作用。 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe >MSBuild.exe Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Framework 版权所有 (C)微软公司。版权所有。 MSBUILD:错误 MSB1003:指定项目或解决方案文件。当前工作目录不包含项目或解决方案文件。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-01-28
  • 2020-02-29
  • 1970-01-01
  • 2020-07-03
  • 2020-12-13
  • 1970-01-01
  • 2020-12-03
相关资源
最近更新 更多