Qiskit 1.0を入れた記録
WSLにインストールしたJupyter Labで作業できるようにします。 インストールにはPIPを使いました。
$ sudo apt install python3-pip
$ pip install jupyterlab
$ sed -i '$aexport PATH="$HOME/.local/bin:$PATH"' .bashrc $ source ~/.bashrc
$ jupyter lab --generate-config
$ vi ~/.jupyter/jupyter_lab_config.py
# c.ServerApp.use_redirect_file = True c.ServerApp.use_redirect_file = False # c.ServerApp.browser = '' c.ServerApp.browser = '/mnt/c/Program\ Files\ \(x86\)/Microsoft/Edge/Application/msedge.exe %s'
$ jupyter lab
$ pip install 'qiskit>=1' pandas matplotlib pylatexenc
Qiskitを実際に動かしてみます。 Jupyter Labを開いて、新しいノートブックを作成します。
from qiskit import *
qr=QuantumRegister(2) cr=ClassicalRegister(2) circuit=QuantumCircuit(qr,cr)
circuit.h(qr[0]) circuit.cx(qr[0], qr[1]) circuit.measure(qr,cr)
%matplotlib inline circuit.draw(output='mpl')
うまくいっていれば、量子回路が表示されるはずです。