无法在 pycharm 中安装 cvxpy

Can't install cvxpy in pycharm

所以我尝试在 pycharm 中安装 cvxpy 包,但出现以下错误:

Collecting ecos==2.0.7.post1
  Using cached ecos-2.0.7.post1.tar.gz (126 kB)
Requirement already satisfied: numpy>=1.6 in d:\programmi (x86)\pythonprojects\lib\site-packages (from ecos==2.0.7.post1) (1.20.3)
Requirement already satisfied: scipy>=0.9 in d:\programmi (x86)\pythonprojects\lib\site-packages (from ecos==2.0.7.post1) (1.6.3)
Using legacy 'setup.py install' for ecos, since package 'wheel' is not installed.
Installing collected packages: ecos
    Running setup.py install for ecos: started
    Running setup.py install for ecos: finished with status 'error'

    ERROR: Command errored out with exit status 1:
     command: 'D:\Programmi (x86)\pythonprojects\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Utente\AppData\Local\Temp\pip-install-8e6ximlz\ecos\setup.py'"'"'; __file__='"'"'C:\Users\Utente\AppData\Local\Temp\pip-install-8e6ximlz\ecos\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Utente\AppData\Local\Temp\pip-record-0jlabp7b\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Programmi (x86)\pythonprojects\include\site\python3.8\ecos'
         cwd: C:\Users\Utente\AppData\Local\Temp\pip-install-8e6ximlz\ecos\
    Complete output (14 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    creating build\lib.win-amd64-3.8\ecos
    copying src\ecos\ecos.py -> build\lib.win-amd64-3.8\ecos
    copying src\ecos\version.py -> build\lib.win-amd64-3.8\ecos
    copying src\ecos\__init__.py -> build\lib.win-amd64-3.8\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: Command errored out with exit status 1: 'D:\Programmi (x86)\pythonprojects\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Utente\AppData\Local\Temp\pip-install-8e6ximlz\ecos\setup.py'"'"'; __file__='"'"'C:\Users\Utente\AppData\Local\Temp\pip-install-8e6ximlz\ecos\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Utente\AppData\Local\Temp\pip-record-0jlabp7b\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Programmi (x86)\pythonprojects\include\site\python3.8\ecos' Check the logs for full command output.
WARNING: You are using pip version 20.2.3; however, version 21.1.1 is available.
You should consider upgrading via the 'D:\Programmi (x86)\pythonprojects\Scripts\python.exe -m pip install --upgrade pip' command.

此外,给我的建议解决方案如下: 尝试从系统终端 运行 此命令。确保为位于 'D:\Programmi (x86)\pythonprojects\Scripts\python.exe'.

的 Python 解释器安装的 'pip' 版本正确

你知道如何解决这个问题吗?我认为如果我尝试安装其他库也可能会出现此错误。

cvxpy' install 部分所述,在使用 pip install 之前,您需要安装 'Visual Studio build tools for Python 3'。

这正是您得到的错误: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/