微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何修复安装Python软件包cvxpy的错误

如何解决如何修复安装Python软件包cvxpy的错误

我正在使用Windows 10和Anaconda,并尝试使用命令提示符安装Python软件包'cvxpy'。我不断收到相同的错误消息。我尝试使用conda安装软件包,重新安装Anaconda,并在Anaconda安装过程中尝试检查/取消选中两个复选框选项,将路径设置为认路径。

我是新来的,并且拒绝使用虚拟环境和/或设置虚拟Linux机器,但是现在我将尝试下一个

C:\Users\john>py -m pip install cvxpy
Collecting cvxpy
  Using cached cvxpy-1.1.7.tar.gz (1.0 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel Metadata ... - ** On entry to DGEBAL parameter number  3 had an illegal value
 ** On entry to DGEHRD  parameter number  2 had an illegal value
 ** On entry to DORGHR DORGQR parameter number  2 had an illegal value
 ** On entry to DHSEQR parameter number  4 had an illegal value
error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\john\anaconda3\python.exe' 'C:\Users\john\anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_Metadata_for_build_wheel 'C:\Users\john\AppData\Local\Temp\tmp9owx0jay'
         cwd: C:\Users\john\AppData\Local\Temp\pip-install-vjri9n__\cvxpy
    Complete output (55 lines):
    running dist_info
    creating C:\Users\john\AppData\Local\Temp\pip-modern-Metadata-r0nwvhtg\cvxpy.egg-info
    writing C:\Users\john\AppData\Local\Temp\pip-modern-Metadata-r0nwvhtg\cvxpy.egg-info\PKG-INFO
    writing dependency_links to C:\Users\john\AppData\Local\Temp\pip-modern-Metadata-r0nwvhtg\cvxpy.egg-info\dependency_links.txt
    writing requirements to C:\Users\john\AppData\Local\Temp\pip-modern-Metadata-r0nwvhtg\cvxpy.egg-info\requires.txt
    writing top-level names to C:\Users\john\AppData\Local\Temp\pip-modern-Metadata-r0nwvhtg\cvxpy.egg-info\top_level.txt
    writing manifest file 'C:\Users\john\AppData\Local\Temp\pip-modern-Metadata-r0nwvhtg\cvxpy.egg-info\SOURCES.txt'
    Traceback (most recent call last):
      File "C:\Users\john\anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py",line 280,in <module>
        main()
      File "C:\Users\john\anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py",line 263,in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "C:\Users\john\anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py",line 133,in prepare_Metadata_for_build_wheel
        return hook(Metadata_directory,config_settings)
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\build_Meta.py",line 161,in prepare_Metadata_for_build_wheel
        self.run_setup()
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\build_Meta.py",line 253,in run_setup
        super(_BuildMetaLegacyBackend,File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\build_Meta.py",line 145,in run_setup
        exec(compile(code,__file__,'exec'),locals())
      File "setup.py",line 57,in <module>
        setup(
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\__init__.py",line 153,in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\john\anaconda3\lib\distutils\core.py",line 148,in setup
        dist.run_commands()
      File "C:\Users\john\anaconda3\lib\distutils\dist.py",line 966,in run_commands
        self.run_command(cmd)
      File "C:\Users\john\anaconda3\lib\distutils\dist.py",line 985,in run_command
        cmd_obj.run()
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\command\dist_info.py",line 31,in run
        egg_info.run()
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\command\egg_info.py",line 298,in run
        self.find_sources()
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\command\egg_info.py",line 305,in find_sources
        mm.run()
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\command\egg_info.py",line 536,in run
        self.add_defaults()
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\command\egg_info.py",line 572,in add_defaults
        sdist.add_defaults(self)
      File "C:\Users\john\anaconda3\lib\distutils\command\sdist.py",line 228,in add_defaults
        self._add_defaults_ext()
      File "C:\Users\john\anaconda3\lib\distutils\command\sdist.py",line 311,in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "C:\Users\john\anaconda3\lib\distutils\cmd.py",line 299,in get_finalized_command
        cmd_obj.ensure_finalized()
      File "C:\Users\john\anaconda3\lib\distutils\cmd.py",line 107,in ensure_finalized
        self.finalize_options()
      File "setup.py",line 23,in finalize_options
        import numpy
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\numpy\__init__.py",in <module>
        _win_os_check()
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\numpy\__init__.py",line 302,in _win_os_check
        raise RuntimeError(msg.format(__file__)) from None
    RuntimeError: The current Numpy installation ('C:\\Users\\john\\AppData\\Local\\Temp\\pip-build-env-j8ppb3ya\\overlay\\Lib\\site-packages\\numpy\\__init__.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://developercommunity.visualstudio.com/content/problem/1207405/fmod-after-an-update-to-windows-2004-is-causing-a.html
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\john\anaconda3\python.exe' 'C:\Users\john\anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_Metadata_for_build_wheel 'C:\Users\john\AppData\Local\Temp\tmp9owx0jay' Check the logs for full command output.

解决方法

这是由numpy 1.19.4引起的已知错误,请尝试取消安装1.19.4版本并安装numpy 1.19.3。

希望它对您有用。

,

从conda-forge安装cvxpy

conda install -c conda-forge cvxpy

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。