安装C++编译的ProjectQ的曲折之路
官网指路
根据官网的Tutorial
It is easiest to install a pre-compiled version of Python, including numpy and many more useful packages. One way to do so is using, e.g., the Python3.5 installers from python.org or ANACONDA. Installing ProjectQ right away will succeed for the (slow) Python simulator (i.e., with the –without-cppsimulator flag).
For a compiled version of the simulator, install the Visual C++ Build Tools and the Microsoft Windows SDK prior to doing a pip install. The built simulator will not support multi-threading due to the limited OpenMP support of msvc.
Should you want to run multi-threaded simulations, you can install a compiler which supports newer OpenMP versions, such as MinGW GCC and then manually build the C++ simulator with OpenMP enabled.
仅仅是Python的安装的话会slow, 那么还是尽可能去安装C++编译的吧.
根据指导安装C++编译的需要两个依赖:
其中Microsoft Windows SDK还需要先安装VS2019
好的, 进过漫长的一夜后, 这两个大家伙终于装好了, 自己电脑又少了几个G的内存.
还会有个报错
但是, 这样子再去pip install projectq
的话还是会报错
其中有一条报错信息长这样
1 | error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158 |
相对的就搜到stackoverflow有一条贴
还需要多做两步事情:
- 将
C:\Program Files (x86)\Windows Kits\10\bin\x64
添加到环境变量中 - 将
C:\Program Files (x86)\Windows Kits\8.1\bin\x86
中的rc.exe
和rcdll.dll
复制到C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
完成
重新pip install projectq
后万事大吉
1 | Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple |
2 | Collecting projectq |
3 | Using cached https://pypi.tuna.tsinghua.edu.cn/packages/2a/3e/138ed37bcc17a5a6903369ce22f665481685b4c66edbfeb1217e593a6f1e/projectq-0.4.2.tar.gz |
4 | Requirement already satisfied: numpy in d:\muyi program files\anaconda\lib\site-packages (from projectq) (1.14.6) |
5 | Requirement already satisfied: future in d:\muyi program files\anaconda\lib\site-packages (from projectq) (0.17.1) |
6 | Requirement already satisfied: pytest>=3.1 in d:\muyi program files\anaconda\lib\site-packages (from projectq) (4.0.2) |
7 | Requirement already satisfied: pybind11>=2.2.3 in d:\muyi program files\anaconda\lib\site-packages (from projectq) (2.2.4) |
8 | Requirement already satisfied: requests in d:\muyi program files\anaconda\lib\site-packages (from projectq) (2.18.4) |
9 | Requirement already satisfied: scipy in d:\muyi program files\anaconda\lib\site-packages (from projectq) (1.1.0) |
10 | |
11 | Requirement already satisfied: networkx in d:\muyi program files\anaconda\lib\site-packages (from projectq) (2.2) |
12 | Requirement already satisfied: py>=1.5.0 in d:\muyi program files\anaconda\lib\site-packages (from pytest>=3.1->projectq) (1.7.0) |
13 | Requirement already satisfied: six>=1.10.0 in d:\muyi program files\anaconda\lib\site-packages (from pytest>=3.1->projectq) (1.12.0) |
14 | Requirement already satisfied: setuptools in d:\muyi program files\anaconda\lib\site-packages (from pytest>=3.1->projectq) (40.6.3) |
15 | Requirement already satisfied: attrs>=17.4.0 in d:\muyi program files\anaconda\lib\site-packages (from pytest>=3.1->projectq) (18.2.0) |
16 | Requirement already satisfied: more-itertools>=4.0.0 in d:\muyi program files\anaconda\lib\site-packages (from pytest>=3.1->projectq) (4.3.0) |
17 | Requirement already satisfied: atomicwrites>=1.0 in d:\muyi program files\anaconda\lib\site-packages (from pytest>=3.1->projectq) (1.2.1) |
18 | Requirement already satisfied: pluggy>=0.7 in d:\muyi program files\anaconda\lib\site-packages (from pytest>=3.1->projectq) (0.8.0) |
19 | Requirement already satisfied: colorama in d:\muyi program files\anaconda\lib\site-packages (from pytest>=3.1->projectq) (0.4.1) |
20 | Requirement already satisfied: idna<2.7,>=2.5 in d:\muyi program files\anaconda\lib\site-packages (from requests->projectq) (2.6) |
21 | Requirement already satisfied: urllib3<1.23,>=1.21.1 in d:\muyi program files\anaconda\lib\site-packages (from requests->projectq) (1.22) |
22 | Requirement already satisfied: certifi>=2017.4.17 in d:\muyi program files\anaconda\lib\site-packages (from requests->projectq) (2018.11.29) |
23 | Requirement already satisfied: chardet<3.1.0,>=3.0.2 in d:\muyi program files\anaconda\lib\site-packages (from requests->projectq) (3.0.4) |
24 | Requirement already satisfied: decorator>=4.3.0 in d:\muyi program files\anaconda\lib\site-packages (from networkx->projectq) (4.3.0) |
25 | Building wheels for collected packages: projectq |
26 | Running setup.py bdist_wheel for projectq ... done |
27 | Stored in directory: C:\Users\ben04\AppData\Local\pip\Cache\wheels\76\40\bc\6b50013be49578da2fc23385b6b283108407eeb6f6dbbc487b |
28 | Successfully built projectq |
29 | Installing collected packages: projectq |
30 | Successfully installed projectq-0.4.2 |