之前我在这篇文章中介绍了如何安装IBM的量子计算编程工具QISKit,这次想要介绍一下另一种基于Python的工具,是由美国的量子计算公司Rigetti开发的Pyquil。这个框架相比于QISKit更加小众一点,但是上手更简单。同时Pyquil也像QISKit一样可以实现对量子电路的模拟,也可以在他们开发的量子芯片(云端)上运行结果。需要注意的是,目前Pyquil没有Windows版本,只有Mac和Linux版。这里给出的是Pyquil在Ubuntu虚拟机上的安装教程,然后也给出了一个简单的Bell State电路作为例程。更多的信息大家可以搜索Pyquil的documentation。
具体的教程如下(抱歉是英文的):
Installation of Pyquil
1. Install anaconda3
After the installation, if here you meet No module called conda
after typing conda, or cannot create or activate a conda enviroment, you need to add conda to path. Thus you need to add a few lines into your bashrc
file.
Step1. Use gedit ~/.bashrc
to open the file
Step2. Add these lines into the file:
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/home/yourusername/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f