Python 3.7:无法在Windows 10的venv中安装gmpy2

问题描述 投票:1回答:1

我正在尝试在Windows 10的虚拟环境中安装gmpy2

最初,我遇到以下错误。

Collecting gmpy2
  Using cached https://files.pythonhosted.org/packages/90/f4/9a2e384b325b69bc5827b9a6510a8fb4a51698c915c06a3f25a86458892a/gmpy2-2.0.8.zip
Installing collected packages: gmpy2
    Running setup.py install for gmpy2: started
    Running setup.py install for gmpy2: finished with status 'error'

    ERROR: Command errored out with exit status 1:
     command: 'C:\Workspace\path\to\project\venv\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\setup.py'"'"'; __file__='"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\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\biles\AppData\Local\Temp\pip-record-p2f519dp\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Workspace\path\to\project\venv\include\site\python3.7\gmpy2'
         cwd: C:\Users\biles\AppData\Local\Temp\pycharm-packaging\gmpy2\
    Complete output (5 lines):
    running install
    running build
    running build_ext
    building 'gmpy2' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Workspace\path\to\project\venv\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\setup.py'"'"'; __file__='"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\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\biles\AppData\Local\Temp\pip-record-p2f519dp\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Workspace\path\to\project\venv\include\site\python3.7\gmpy2' Check the logs for full command output.

通过从https://visualstudio.microsoft.com/downloads/安装Visual Studio的构建工具,我能够克服此错误。

我再次尝试,这一次出现以下错误。

Collecting gmpy2
  Using cached https://files.pythonhosted.org/packages/90/f4/9a2e384b325b69bc5827b9a6510a8fb4a51698c915c06a3f25a86458892a/gmpy2-2.0.8.zip
Installing collected packages: gmpy2
    Running setup.py install for gmpy2: started
    Running setup.py install for gmpy2: finished with status 'error'

    ERROR: Command errored out with exit status 1:
     command: 'C:\Workspace\path\to\project\venv\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\setup.py'"'"'; __file__='"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\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\biles\AppData\Local\Temp\pip-record-i495p48z\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Workspace\path\to\project\venv\include\site\python3.7\gmpy2'
         cwd: C:\Users\biles\AppData\Local\Temp\pycharm-packaging\gmpy2\
    Complete output (12 lines):
    running install
    running build
    running build_ext
    building 'gmpy2' extension
    creating build
    creating build\temp.win32-3.7
    creating build\temp.win32-3.7\Release
    creating build\temp.win32-3.7\Release\src
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -DMPIR -DWITHMPFR -DWITHMPC -IC:\Workspace\path\to\project\venv\include -IC:\Users\biles\AppData\Local\Programs\Python\Python37-32\include -IC:\Users\biles\AppData\Local\Programs\Python\Python37-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcsrc\gmpy2.c /Fobuild\temp.win32-3.7\Release\src\gmpy2.obj
    gmpy2.c
    C:\Users\biles\AppData\Local\Temp\pycharm-packaging\gmpy2\src\gmpy.h(104): fatal error C1083: Cannot open include file: 'mpir.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Workspace\path\to\project\venv\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\setup.py'"'"'; __file__='"'"'C:\\Users\\biles\\AppData\\Local\\Temp\\pycharm-packaging\\gmpy2\\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\biles\AppData\Local\Temp\pip-record-i495p48z\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Workspace\path\to\project\venv\include\site\python3.7\gmpy2' Check the logs for full command output.

我尝试将版本指定为2.1.0a4,然后指定为2.1.0a2,然后指定为2.0.8。但是我遇到了同样的错误。

注意:我正在尝试通过PyCharm设置->项目解释器安装此软件包。

我正在尝试在Windows 10的虚拟环境中安装gmpy2。最初,我遇到以下错误。使用缓存的https://files.pythonhosted.org/packages/90/f4 / ...

python python-3.x python-3.7 python-venv gmpy
1个回答
0
投票

在Windows 10中安装gmpy2

© www.soinside.com 2019 - 2024. All rights reserved.