我正在尝试在Win10上安装qiskit。 我输入了我的管理员cmd:
pip install qiskit
它非常适合 terra、ignis 和 aqua。 但是,我在安装 aer 时遇到了 C 编译器问题。 这是错误消息:
Microsoft Windows [version 10.0.18363.959]
(c) 2019 Microsoft Corporation. Tous droits réservés.
C:\WINDOWS\system32>pip install qiskit
Processing c:\users\bohro\appdata\local\pip\cache\wheels\4d\00\27\1b79b2da1898a0d95508661eb1922c6d44be088f2719708a98\qiskit-0.19.6-py3-none-any.whl
Requirement already satisfied: qiskit-ignis==0.3.3 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit) (0.3.3)
Requirement already satisfied: qiskit-ibmq-provider==0.7.2 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit) (0.7.2)
Requirement already satisfied: qiskit-aqua==0.7.3 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit) (0.7.3)
Requirement already satisfied: qiskit-terra==0.14.2 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit) (0.14.2)
Collecting qiskit-aer==0.5.2
Using cached qiskit-aer-0.5.2.tar.gz (10.3 MB)
Requirement already satisfied: scipy!=0.19.1,>=0.19 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-ignis==0.3.3->qiskit) (1.5.2)
Requirement already satisfied: setuptools>=40.1.0 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-ignis==0.3.3->qiskit) (49.2.1)
Requirement already satisfied: scikit-learn>=0.17 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-ignis==0.3.3->qiskit) (0.23.2)
Requirement already satisfied: numpy>=1.13 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-ignis==0.3.3->qiskit) (1.19.1)
Requirement already satisfied: requests>=2.19 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-ibmq-provider==0.7.2->qiskit) (2.22.0)
Requirement already satisfied: nest-asyncio!=1.1.0,>=1.0.0 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-ibmq-provider==0.7.2->qiskit) (1.4.0)
Requirement already satisfied: python-dateutil>=2.8.0 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-ibmq-provider==0.7.2->qiskit) (2.8.1)
Requirement already satisfied: urllib3>=1.21.1 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-ibmq-provider==0.7.2->qiskit) (1.25.7)
Requirement already satisfied: requests-ntlm>=1.1.0 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-ibmq-provider==0.7.2->qiskit) (1.1.0)
Requirement already satisfied: websockets<8,>=7 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-ibmq-provider==0.7.2->qiskit) (7.0)
Requirement already satisfied: fastdtw in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-aqua==0.7.3->qiskit) (0.3.4)
Requirement already satisfied: h5py in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-aqua==0.7.3->qiskit) (2.10.0)
Requirement already satisfied: networkx>=2.2 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-aqua==0.7.3->qiskit) (2.4)
Requirement already satisfied: sympy>=1.3 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-aqua==0.7.3->qiskit) (1.5.1)
Requirement already satisfied: quandl in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-aqua==0.7.3->qiskit) (3.5.2)
Requirement already satisfied: docplex in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-aqua==0.7.3->qiskit) (2.15.194)
Requirement already satisfied: psutil>=5 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-aqua==0.7.3->qiskit) (5.7.2)
Requirement already satisfied: dlx in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-aqua==0.7.3->qiskit) (1.0.4)
Requirement already satisfied: dill>=0.3 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-terra==0.14.2->qiskit) (0.3.2)
Requirement already satisfied: ply>=3.10 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-terra==0.14.2->qiskit) (3.11)
Requirement already satisfied: marshmallow<4,>=3 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-terra==0.14.2->qiskit) (3.7.1)
Requirement already satisfied: retworkx>=0.3.2 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-terra==0.14.2->qiskit) (0.4.0)
Requirement already satisfied: marshmallow-polyfield<6,>=5.7 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-terra==0.14.2->qiskit) (5.9)
Requirement already satisfied: jsonschema>=2.6 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-terra==0.14.2->qiskit) (2.6.0)
Requirement already satisfied: fastjsonschema>=2.10 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-terra==0.14.2->qiskit) (2.14.4)
Requirement already satisfied: python-constraint>=1.4 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-terra==0.14.2->qiskit) (1.4.0)
Requirement already satisfied: cython>=0.27.1 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-aer==0.5.2->qiskit) (0.29.21)
Requirement already satisfied: pybind11>=2.4 in c:\program files (x86)\python\python36-32\lib\site-packages (from qiskit-aer==0.5.2->qiskit) (2.5.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in c:\program files (x86)\python\python36-32\lib\site-packages (from scikit-learn>=0.17->qiskit-ignis==0.3.3->qiskit) (2.1.0)
Requirement already satisfied: joblib>=0.11 in c:\program files (x86)\python\python36-32\lib\site-packages (from scikit-learn>=0.17->qiskit-ignis==0.3.3->qiskit) (0.16.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\program files (x86)\python\python36-32\lib\site-packages (from requests>=2.19->qiskit-ibmq-provider==0.7.2->qiskit) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in c:\program files (x86)\python\python36-32\lib\site-packages (from requests>=2.19->qiskit-ibmq-provider==0.7.2->qiskit) (2.8)
Requirement already satisfied: certifi>=2017.4.17 in c:\program files (x86)\python\python36-32\lib\site-packages (from requests>=2.19->qiskit-ibmq-provider==0.7.2->qiskit) (2019.11.28)
Requirement already satisfied: six>=1.5 in c:\program files (x86)\python\python36-32\lib\site-packages (from python-dateutil>=2.8.0->qiskit-ibmq-provider==0.7.2->qiskit) (1.10.0)
Requirement already satisfied: ntlm-auth>=1.0.2 in c:\program files (x86)\python\python36-32\lib\site-packages (from requests-ntlm>=1.1.0->qiskit-ibmq-provider==0.7.2->qiskit) (1.5.0)
Requirement already satisfied: cryptography>=1.3 in c:\program files (x86)\python\python36-32\lib\site-packages (from requests-ntlm>=1.1.0->qiskit-ibmq-provider==0.7.2->qiskit) (3.0)
Requirement already satisfied: decorator>=4.3.0 in c:\program files (x86)\python\python36-32\lib\site-packages (from networkx>=2.2->qiskit-aqua==0.7.3->qiskit) (4.4.2)
Requirement already satisfied: mpmath>=0.19 in c:\program files (x86)\python\python36-32\lib\site-packages (from sympy>=1.3->qiskit-aqua==0.7.3->qiskit) (1.1.0)
Requirement already satisfied: inflection>=0.3.1 in c:\program files (x86)\python\python36-32\lib\site-packages (from quandl->qiskit-aqua==0.7.3->qiskit) (0.5.0)
Requirement already satisfied: pandas>=0.14 in c:\program files (x86)\python\python36-32\lib\site-packages (from quandl->qiskit-aqua==0.7.3->qiskit) (0.20.3)
Requirement already satisfied: more-itertools in c:\program files (x86)\python\python36-32\lib\site-packages (from quandl->qiskit-aqua==0.7.3->qiskit) (8.4.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\program files (x86)\python\python36-32\lib\site-packages (from cryptography>=1.3->requests-ntlm>=1.1.0->qiskit-ibmq-provider==0.7.2->qiskit) (1.14.1)
Requirement already satisfied: pytz>=2011k in c:\program files (x86)\python\python36-32\lib\site-packages (from pandas>=0.14->quandl->qiskit-aqua==0.7.3->qiskit) (2017.2)
Requirement already satisfied: pycparser in c:\program files (x86)\python\python36-32\lib\site-packages (from cffi!=1.11.3,>=1.8->cryptography>=1.3->requests-ntlm>=1.1.0->qiskit-ibmq-provider==0.7.2->qiskit) (2.20)
Building wheels for collected packages: qiskit-aer
Building wheel for qiskit-aer (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\program files (x86)\python\python36-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\bohro\\AppData\\Local\\Temp\\pip-install-l0zhdsp2\\qiskit-aer\\setup.py'"'"'; __file__='"'"'C:\\Users\\bohro\\AppData\\Local\\Temp\\pip-install-l0zhdsp2\\qiskit-aer\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\bohro\AppData\Local\Temp\pip-wheel-a8l2_d9y'
cwd: C:\Users\bohro\AppData\Local\Temp\pip-install-l0zhdsp2\qiskit-aer\
Complete output (181 lines):
--------------------------------------------------------------------------------
-- Trying "Ninja (Visual Studio 15 2017 v141)" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
Not searching for unused variables given on the command line.
-- The C compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Programs/cygwin64/bin/cc
-- Check for working C compiler: C:/Programs/cygwin64/bin/cc - broken
CMake Error at C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/.eggs/cmake-3.18.0-py3.6-win32.egg/cmake/data/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"C:/Programs/cygwin64/bin/cc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Users/bohro/Documents/Programs/ninja-win/ninja.exe cmTC_ba073 && ninja: fatal: CreateProcess: AccÞs refusÚ.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (ENABLE_LANGUAGE)
-- Configuring incomplete, errors occurred!
See also "C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeError.log".
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "Ninja (Visual Studio 15 2017 v141)" generator - failure
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Trying "Visual Studio 15 2017 v141" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
Not searching for unused variables given on the command line.
CMake Error at CMakeLists.txt:2 (PROJECT):
Generator
Visual Studio 15 2017
could not find any instance of Visual Studio.
-- Configuring incomplete, errors occurred!
See also "C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "Visual Studio 15 2017 v141" generator - failure
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Trying "NMake Makefiles (Visual Studio 15 2017 v141)" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
Not searching for unused variables given on the command line.
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeError.log".
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "NMake Makefiles (Visual Studio 15 2017 v141)" generator - failure
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Trying "NMake Makefiles JOM (Visual Studio 15 2017 v141)" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
Not searching for unused variables given on the command line.
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the JOM generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeError.log".
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "NMake Makefiles JOM (Visual Studio 15 2017 v141)" generator - failure
--------------------------------------------------------------------------------
********************************************************************************
scikit-build could not get a working generator for your system. Aborting build.
Building windows wheels for Python 3.6 requires Microsoft Visual Studio 2017.
Get it with "Visual Studio 2017":
https://visualstudio.microsoft.com/vs/
********************************************************************************
----------------------------------------
ERROR: Failed building wheel for qiskit-aer
Running setup.py clean for qiskit-aer
Failed to build qiskit-aer
DEPRECATION: Could not build wheels for qiskit-aer which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
Installing collected packages: qiskit-aer, qiskit
Running setup.py install for qiskit-aer ... error
ERROR: Command errored out with exit status 1:
command: 'c:\program files (x86)\python\python36-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\bohro\\AppData\\Local\\Temp\\pip-install-l0zhdsp2\\qiskit-aer\\setup.py'"'"'; __file__='"'"'C:\\Users\\bohro\\AppData\\Local\\Temp\\pip-install-l0zhdsp2\\qiskit-aer\\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\bohro\AppData\Local\Temp\pip-record-di0j_g0q\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\program files (x86)\python\python36-32\Include\qiskit-aer'
cwd: C:\Users\bohro\AppData\Local\Temp\pip-install-l0zhdsp2\qiskit-aer\
Complete output (181 lines):
--------------------------------------------------------------------------------
-- Trying "Ninja (Visual Studio 15 2017 v141)" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
Not searching for unused variables given on the command line.
-- The C compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Programs/cygwin64/bin/cc
-- Check for working C compiler: C:/Programs/cygwin64/bin/cc - broken
CMake Error at C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/.eggs/cmake-3.18.0-py3.6-win32.egg/cmake/data/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"C:/Programs/cygwin64/bin/cc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Users/bohro/Documents/Programs/ninja-win/ninja.exe cmTC_762f9 && ninja: fatal: CreateProcess: AccÞs refusÚ.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (ENABLE_LANGUAGE)
-- Configuring incomplete, errors occurred!
See also "C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeError.log".
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "Ninja (Visual Studio 15 2017 v141)" generator - failure
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Trying "Visual Studio 15 2017 v141" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
Not searching for unused variables given on the command line.
CMake Error at CMakeLists.txt:2 (PROJECT):
Generator
Visual Studio 15 2017
could not find any instance of Visual Studio.
-- Configuring incomplete, errors occurred!
See also "C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "Visual Studio 15 2017 v141" generator - failure
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Trying "NMake Makefiles (Visual Studio 15 2017 v141)" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
Not searching for unused variables given on the command line.
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeError.log".
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "NMake Makefiles (Visual Studio 15 2017 v141)" generator - failure
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Trying "NMake Makefiles JOM (Visual Studio 15 2017 v141)" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
Not searching for unused variables given on the command line.
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the JOM generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/bohro/AppData/Local/Temp/pip-install-l0zhdsp2/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeError.log".
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "NMake Makefiles JOM (Visual Studio 15 2017 v141)" generator - failure
--------------------------------------------------------------------------------
********************************************************************************
scikit-build could not get a working generator for your system. Aborting build.
Building windows wheels for Python 3.6 requires Microsoft Visual Studio 2017.
Get it with "Visual Studio 2017":
https://visualstudio.microsoft.com/vs/
********************************************************************************
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files (x86)\python\python36-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\bohro\\AppData\\Local\\Temp\\pip-install-l0zhdsp2\\qiskit-aer\\setup.py'"'"'; __file__='"'"'C:\\Users\\bohro\\AppData\\Local\\Temp\\pip-install-l0zhdsp2\\qiskit-aer\\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\bohro\AppData\Local\Temp\pip-record-di0j_g0q\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\program files (x86)\python\python36-32\Include\qiskit-aer' Check the logs for full command output.
C:\WINDOWS\system32>
据我了解,这个问题与cygwin有关(这已经给我带来了很多麻烦——再也不用它了,暂时保留它,因为大学项目需要它)。我已经安装了Cmake,我可以打开cmake-gui。 但我不知道如何让这个编译器被 pip 使用。
此外,与错误消息所述相反,我确实有 Visual Studio...
感谢您的帮助, 卡尔8578
这里的问题是您使用的是 32 位版本的 python。 Qiskit Aer 仅作为 win64 的 pypi 上的预编译二进制文件发布,因此当您运行
pip install qiskit
pip 时,会查看 qiskit-aer 的 pypi 上可用的预编译二进制文件,但看不到任何与其运行的 python win32 兼容的文件。然后它转而使用 sdist(源代码包)并尝试从源代码安装它。不幸的是,aer 构建系统有点混乱,尤其是在 Windows 上,如果没有手动干预,它很少能工作。实际上,您不需要 anaconda 即可轻松在 Windows 上安装 64 位版本的 python。
好的,这是我找到的解决方法。
免责声明:这个解决方案并不完美,因为它需要您安装另一个Python/重新安装整个Python。
1/ 下载 Anaconda 3,并安装 Python 3.8(64 位)。
2/ 通过 Anaconda Powershell 提示符(而不是常用的 cmd),pip install qiskit。
3/ 您应该能够在 Anaconda Jupyter 笔记本中运行 qiskit(确保您使用 Anaconda 的 Jupyter,而不是之前安装的其他 Jupyter)。
这就是我的“解决方案”。它显然并不完美,就好像(像我一样)你已经有一个非 Anaconda Python 并将其用于某些任务,你最终会拥有两个 Python,这总体上不是一件好事,因为它可能会产生冲突。 如果您不太关心完全卸载 Python,然后按照上述步骤操作,那么如果您想在自己的笔记本上运行 qiskit,这是一个不错的选择。
(由于这个解决方案的主要缺陷是需要另一个Python安装,我仍然愿意接受任何可以帮助我解决我最初的问题的想法。谢谢,Kal8578)
如果您在 Windows 上遇到此错误:
qiskit aer 的建筑轮失败
那么你需要在 conda 环境中替换 Python:
conda install python=3.12
现在你可以安装qiskit_aer了:
pip install qiskit_aer