我正在尝试在 Windows 上使用 Pycharm 在 Python 3.9.7 中安装 cvxpy 包。我收到此错误:根据我在网上可以找到的信息,我已经安装了 C++,降级了 Python 版本并更新了 pip。卸载所有东西并重新安装软件。没有任何效果
Collecting cvxpy
Using cached cvxpy-1.1.15-cp39-cp39-win_amd64.whl (848 kB)
Requirement already satisfied: numpy>=1.15 in c:\users\pc\pycharmprojects\pythonproject\graduateproject1\venv\lib\site-packages (from cvxpy) (1.21.2)
Requirement already satisfied: scipy>=1.1.0 in c:\users\pc\pycharmprojects\pythonproject\graduateproject1\venv\lib\site-packages (from cvxpy) (1.7.1)
Collecting osqp>=0.4.1
Using cached osqp-0.6.2.post0-cp39-cp39-win_amd64.whl (162 kB)
Collecting ecos>=2
Using cached ecos-2.0.7.post1.tar.gz (126 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting scs>=1.1.6
Using cached scs-2.1.4.tar.gz (6.6 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata (pyproject.toml): started
Preparing wheel metadata (pyproject.toml): finished with status 'done'
Collecting qdldl
Using cached qdldl-0.1.5.post0-cp39-cp39-win_amd64.whl (74 kB)
Building wheels for collected packages: ecos, scs
Building wheel for ecos (setup.py): started
Building wheel for ecos (setup.py): finished with status 'error'
Running setup.py clean for ecos
Building wheel for scs (pyproject.toml): started
Building wheel for scs (pyproject.toml): finished with status 'error'
Failed to build ecos scs
ERROR: Command errored out with exit status 1:
command: 'C:\Users\PC\PycharmProjects\pythonProject\GraduateProject1\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\PC\\AppData\\Local\\Temp\\pip-install-nl0srv3d\\ecos_3d50533729b941a9a5a70675d54720f5\\setup.py'"'"'; __file__='"'"'C:\\Users\\PC\\AppData\\Local\\Temp\\pip-install-nl0srv3d\\ecos_3d50533729b941a9a5a70675d54720f5\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\PC\AppData\Local\Temp\pip-wheel-idg7b5ou'
cwd: C:\Users\PC\AppData\Local\Temp\pip-install-nl0srv3d\ecos_3d50533729b941a9a5a70675d54720f5\
Complete output (14 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\ecos
copying src\ecos\ecos.py -> build\lib.win-amd64-3.9\ecos
copying src\ecos\version.py -> build\lib.win-amd64-3.9\ecos
copying src\ecos\__init__.py -> build\lib.win-amd64-3.9\ecos
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building '_ecos' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for ecos
ERROR: Command errored out with exit status 1:
command: 'C:\Users\PC\PycharmProjects\pythonProject\GraduateProject1\venv\Scripts\python.exe' 'C:\Users\PC\PycharmProjects\pythonProject\GraduateProject1\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 'C:\Users\PC\AppData\Local\Temp\tmp8dsk4sez'
cwd: C:\Users\PC\AppData\Local\Temp\pip-install-nl0srv3d\scs_8099462db0a64ae4b7c4eee9d370cc96
Complete output (84 lines):
Namespace(scs=False, gpu=False, float32=False, extraverbose=False, gpu_atrans=True, int32=False, blas64=False)
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\scs
copying src\__init__.py -> build\lib.win-amd64-3.9\scs
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
blas_mkl_info:
NOT AVAILABLE
blis_info:
NOT AVAILABLE
openblas_info:
library_dirs = ['D:\\a\\1\\s\\numpy\\build\\openblas_info']
libraries = ['openblas_info']
language = f77
define_macros = [('HAVE_CBLAS', None)]
blas_opt_info:
library_dirs = ['D:\\a\\1\\s\\numpy\\build\\openblas_info']
libraries = ['openblas_info']
language = f77
define_macros = [('HAVE_CBLAS', None)]
lapack_mkl_info:
NOT AVAILABLE
openblas_lapack_info:
library_dirs = ['D:\\a\\1\\s\\numpy\\build\\openblas_lapack_info']
libraries = ['openblas_lapack_info']
language = f77
define_macros = [('HAVE_CBLAS', None)]
lapack_opt_info:
library_dirs = ['D:\\a\\1\\s\\numpy\\build\\openblas_lapack_info']
libraries = ['openblas_lapack_info']
language = f77
define_macros = [('HAVE_CBLAS', None)]
Could not locate executable g77
Could not locate executable f77
Could not locate executable ifort
Could not locate executable ifl
Could not locate executable f90
Could not locate executable DF
Could not locate executable efl
Could not locate executable gfortran
Could not locate executable f95
Could not locate executable g95
Could not locate executable efort
Could not locate executable efc
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
C:\Users\PC\AppData\Local\Temp\pip-build-env-cz92izs3\overlay\Lib\site-packages\numpy\distutils\system_info.py:1914: UserWarning:
Optimized (vendor) Blas libraries are not found.
Falls back to netlib Blas library which has worse performance.
A better performance should be easily gained by switching
Blas library.
if self._calc_info(blas):
C:\Users\PC\AppData\Local\Temp\pip-build-env-cz92izs3\overlay\Lib\site-packages\numpy\distutils\system_info.py:1914: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
if self._calc_info(blas):
C:\Users\PC\AppData\Local\Temp\pip-build-env-cz92izs3\overlay\Lib\site-packages\numpy\distutils\system_info.py:1914: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
if self._calc_info(blas):
C:\Users\PC\AppData\Local\Temp\pip-build-env-cz92izs3\overlay\Lib\site-packages\numpy\distutils\system_info.py:1748: UserWarning:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
return getattr(self, '_calc_info_{}'.format(name))()
C:\Users\PC\AppData\Local\Temp\pip-build-env-cz92izs3\overlay\Lib\site-packages\numpy\distutils\system_info.py:1748: 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 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for scs
ERROR: Could not build wheels for scs, which is required to install pyproject.toml-based projects
我已经尝试过使用 pip 和 Pycharm 设置
有人遇到过这个问题并找到了解决方案吗?