{"id":31191,"date":"2026-11-20T15:39:35","date_gmt":"2026-11-20T07:39:35","guid":{"rendered":"https:\/\/www.ixpower.cn\/index.php\/2026\/11\/20\/31191\/"},"modified":"2026-11-20T15:39:35","modified_gmt":"2026-11-20T07:39:35","slug":"10%e5%88%86%e9%92%9f%e6%95%99%e4%bd%a0%e4%bd%bf%e7%94%a8ibm%e9%87%8f%e5%ad%90%e8%bd%af%e4%bb%b6%e5%b9%b3%e5%8f%b0qiskit","status":"publish","type":"post","link":"https:\/\/www.ixpower.cn\/index.php\/2026\/11\/20\/31191\/","title":{"rendered":"10\u5206\u949f\u6559\u4f60\u4f7f\u7528IBM\u91cf\u5b50\u8f6f\u4ef6\u5e73\u53f0Qiskit"},"content":{"rendered":"<p>\u8fd9\u91cc\u4f7f\u7528\u7684\u64cd\u4f5c\u7cfb\u7edf\u73af\u5883\u4e3a64\u4f4d\u7684Ubuntu18.04.2 LTS\u3002<\/p>\n<p>\u4e00\u3001\u5b89\u88c5\u76f8\u5173\u8f6f\u4ef6\u5305<\/p>\n<p>1. \u5b89\u88c5\u914d\u7f6epython3\u73af\u5883<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li>\u00a0<\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"nginx\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attribute\">sudo<\/span> apt install python3<\/span><\/code><\/pre>\n<\/section>\n<p>\u5728apt\u5b89\u88c5\u65f6\uff0c\u53ef\u4ee5\u63d0\u524d\u4fee\u6539\u7cfb\u7edf\u7684apt\u6e90\u4ee5\u63d0\u9ad8\u5b89\u88c5\u901f\u5ea6\uff0c\u5177\u4f53\u7684\u4fee\u6539\u65b9\u6cd5\u53ef\u81ea\u884c\u767e\u5ea6\u3002<\/p>\n<p>2. \u5b89\u88c5pip\u73af\u5883<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li>\u00a0<\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"nginx\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attribute\">sudo<\/span> apt install python3-pip<\/span><\/code><\/pre>\n<\/section>\n<p>3.\u00a0\u5b89\u88c5jupyter notebook<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li>\u00a0<\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"nginx\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attribute\">sudo<\/span> pip3 install -i https:\/\/pypi.tuna.tsinghua.edu.cn\/simple notebook<\/span><\/code><\/pre>\n<\/section>\n<p>\u8fd9\u91cc\u4f7f\u7528\u4e86\u6e05\u534e\u6e90\uff0c\u4f7f\u5f97pip\u7684\u5b89\u88c5\u901f\u5ea6\u6709\u4e86\u5f88\u5feb\u7684\u63d0\u5347\u3002<\/p>\n<p>4.\u00a0\u5b89\u88c5qiskit\u73af\u5883<\/p>\n<p>\u9996\u5148\u9700\u8981\u66f4\u65b0setuptools\u7248\u672c\uff0c\u5426\u5219\u540e\u9762\u7684\u5b89\u88c5\u4f1a\u51fa\u73b0\u95ee\u9898\u3002<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li>\u00a0<\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"nginx\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attribute\">sudo<\/span> pip3 install -i https:\/\/pypi.tuna.tsinghua.edu.cn\/simple --upgrade setuptools<\/span><\/code><\/pre>\n<\/section>\n<p>\u5b89\u88c5python\u56fe\u5f62\u8f6f\u4ef6\u5305\uff1a<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li>\u00a0<\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"nginx\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attribute\">sudo<\/span> pip3 install -i https:\/\/pypi.tuna.tsinghua.edu.cn\/simple matplotlib<\/span><\/code><\/pre>\n<\/section>\n<p>\u5b89\u88c5qiskit 0.12.x\u7248\u672c\uff1a<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li>\u00a0<\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"nginx\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attribute\">sudo<\/span> pip3 install -i https:\/\/pypi.tuna.tsinghua.edu.cn\/simple qiskit==<span class=\"code-snippet__number\">0<\/span>.<span class=\"code-snippet__number\">12<\/span><\/span><\/code><\/pre>\n<\/section>\n<p>\u5b89\u88c5\u7684\u65f6\u95f4\u76f8\u5bf9\u6709\u4e9b\u957f\uff0c\u9700\u8981\u8010\u5fc3\u7b49\u5f85\u3002<\/p>\n<p>\u4e2a\u4eba\u6bd4\u8f83\u63a8\u83500.12\u7248\u672c\uff0c\u592a\u65b0\u7684\u7248\u672c\u5f80\u5f80\u7531\u4e8e\u5e93\u5339\u914d\u7684\u95ee\u9898\u51fa\u73b0\u975e\u5e38\u591a\u7684\u9519\u8bef\u3002<\/p>\n<p>5.\u00a0\u4e0b\u8f7dqiskit\u6e90\u4ee3\u7801<\/p>\n<p>\u8fd9\u91cc\u6ce8\u610f\uff0c\u4e0a\u9762\u5b89\u88c5\u7684qiskit\u73af\u5883\u5fc5\u987b\u8981\u4e0etutorial\u4e2d\u7684\u7248\u672c\u76f8\u5bf9\u5e94\uff0c\u5728github\u4e2d\u9700\u8981\u9009\u62e9\u5bf9\u5e94\u7684qiskit tutorial\u7248\u672c\uff0c\u5426\u5219\uff0c\u7531\u4e8eqiskit\u7684\u66f4\u65b0\u901f\u5ea6\u8f83\u5feb\uff0c\u7248\u672c\u4e00\u65e6\u4e0d\u5339\u914d\u5c31\u5bb9\u6613\u51fa\u73b0\u95ee\u9898\u3002<\/p>\n<p>\u5177\u4f53\u7684\u4e0b\u8f7d\u8fde\u63a5\u5982\u4e0b\uff1a<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li>\u00a0<\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"javascript\"><code><span class=\"code-snippet_outer\">https:<span class=\"code-snippet__comment\">\/\/github.com\/Qiskit\/qiskit-tutorials\/tree\/stable\/0.12.x<\/span><\/span><\/code><\/pre>\n<\/section>\n<p>\u00a0<\/p>\n<p><img data-dominant-color=\"f3f2f0\" data-has-transparency=\"true\" style=\"--dominant-color: #f3f2f0;\" loading=\"lazy\" decoding=\"async\" class=\"has-transparency alignnone size-full wp-image-31183\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/11\/20261120073935535.png\" width=\"150\" height=\"36\" alt=\"\" \/><\/p>\n<p>\u4e8c\u3001\u89e3\u538b\u6e90\u4ee3\u7801\u5e76\u6267\u884c<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"properties\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attr\">unzip<\/span> <span class=\"code-snippet__string\">qiskit-tutorials-stable-0.12.x.zip<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attr\">cd<\/span> <span class=\"code-snippet__string\">qiskit-tutorials-stable-0.12.x\/<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attr\">jupyter\u00a0notebook<\/span><\/span><\/code><\/pre>\n<\/section>\n<p>\u00a0<\/p>\n<p><img data-dominant-color=\"fbfbfc\" data-has-transparency=\"true\" style=\"--dominant-color: #fbfbfc;\" loading=\"lazy\" decoding=\"async\" class=\"has-transparency alignnone size-full wp-image-31184\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/11\/20261120073936125.png\" width=\"150\" height=\"131\" alt=\"\" \/><\/p>\n<p>\u8fdb\u5165qiskit\uff0c\u53ef\u4ee5\u770b\u5230\u6709\u5173\u4e8eqiskit\u7684\u57fa\u672c\u6559\u7a0b\u548c\u8fdb\u9636\u6559\u7a0b\u3002\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u8981\u81ea\u884c\u4f7f\u7528\u3002<\/p>\n<p>\u4e09\u3001\u7f16\u5199\u4ee3\u7801<\/p>\n<p>\u5728jupyter\u73af\u5883\u4e2d\u65b0\u5efa\u4e00\u4e2apython\u6587\u4ef6\uff0c\u5e76\u586b\u5165\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">import<\/span> numpy <span class=\"code-snippet__keyword\">as<\/span> np<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">from<\/span> qiskit <span class=\"code-snippet__keyword\">import<\/span> *<\/span><\/code><code><span class=\"code-snippet_outer\">%matplotlib inline<\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Create a Quantum Circuit acting on a quantum register of three qubits<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">circ = QuantumCircuit(<span class=\"code-snippet__number\">4<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Add a H gate on qubit 0, putting this qubit in superposition.<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">circ.h(<span class=\"code-snippet__number\">0<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Add a CX (CNOT) gate on control qubit 0 and target qubit 1, putting<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># the qubits in a Bell state.<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">circ.cx(<span class=\"code-snippet__number\">0<\/span>, <span class=\"code-snippet__number\">1<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Add a CX (CNOT) gate on control qubit 1 and target qubit 2<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">circ.cx(<span class=\"code-snippet__number\">1<\/span>, <span class=\"code-snippet__number\">2<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Add a CX (CNOT) gate on control qubit 2 and target qubit 3<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">circ.cx(<span class=\"code-snippet__number\">2<\/span>, <span class=\"code-snippet__number\">3<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># visualize the circuit<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">circ.draw()<\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><\/pre>\n<\/section>\n<p>\u6267\u884c\u4e0a\u8ff0\u4ee3\u7801\u53ef\u4ee5\u5f97\u5230\u91cf\u5b50\u7ebf\u8def\u56fe\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><img data-dominant-color=\"f1f1f1\" data-has-transparency=\"true\" style=\"--dominant-color: #f1f1f1;\" loading=\"lazy\" decoding=\"async\" class=\"has-transparency alignnone size-full wp-image-31185\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/11\/20261120073936955.png\" width=\"150\" height=\"77\" alt=\"\" \/><\/p>\n<p>\u4e0a\u9762\u7684\u4ee3\u7801\u6ca1\u6709\u6d4b\u91cf\u64cd\u4f5c\uff0c\u5982\u679c\u8981\u52a0\u5165\u6d4b\u91cf\u64cd\u4f5c\uff0c\u5fc5\u987b\u8981\u5f15\u5165\u7ecf\u5178\u91cf\u5b50\u6bd4\u7279\u3002\u4ee3\u7801\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"python\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">import<\/span> numpy <span class=\"code-snippet__keyword\">as<\/span> np<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">from<\/span> qiskit <span class=\"code-snippet__keyword\">import<\/span> *<\/span><\/code><code><span class=\"code-snippet_outer\">%matplotlib inline<\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Create a Quantum Circuit acting on a quantum register of three qubits<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">circ = QuantumCircuit(<span class=\"code-snippet__number\">4<\/span>, <span class=\"code-snippet__number\">4<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Add a H gate on qubit 0, putting this qubit in superposition.<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">circ.h(<span class=\"code-snippet__number\">0<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Add a CX (CNOT) gate on control qubit 0 and target qubit 1, putting<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># the qubits in a Bell state.<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">circ.cx(<span class=\"code-snippet__number\">0<\/span>, <span class=\"code-snippet__number\">1<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Add a CX (CNOT) gate on control qubit 1 and target qubit 2<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">circ.cx(<span class=\"code-snippet__number\">1<\/span>, <span class=\"code-snippet__number\">2<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Add a CX (CNOT) gate on control qubit 2 and target qubit 3<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">circ.cx(<span class=\"code-snippet__number\">2<\/span>, <span class=\"code-snippet__number\">3<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\">circ.measure(range(<span class=\"code-snippet__number\">4<\/span>), range(<span class=\"code-snippet__number\">4<\/span>))<\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># visualize the circuit<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">circ.draw()<\/span><\/code><\/pre>\n<\/section>\n<p>\u751f\u6210\u7684\u7ebf\u8def\u56fe\u5982\u4e0b\u6240\u793a\u3002\u53ef\u4ee5\u770b\u51fa\uff0c\u6240\u6709\u7684\u91cf\u5b50\u6bd4\u7279\u7684\u6d4b\u91cf\u7ed3\u679c\u90fd\u88ab\u5b58\u50a8\u5230\u4e86\u7ecf\u5178\u6bd4\u7279\u4e2d\u3002<\/p>\n<p><img data-dominant-color=\"eeeeed\" data-has-transparency=\"true\" style=\"--dominant-color: #eeeeed;\" loading=\"lazy\" decoding=\"async\" class=\"has-transparency alignnone size-full wp-image-31186\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/11\/20261120073936745.png\" width=\"150\" height=\"106\" alt=\"\" \/><\/p>\n<p>\u5728IBM\u7684\u91cf\u5b50\u8ba1\u7b97\u673a\u4e2d\uff0c\u57fa\u672c\u7684\u95e8\u5305\u62ecu1\u3001u2\u3001u3\u3001cx\u548cid\u95e8\uff0c\u5176\u4ed6\u7684\u95e8\u90fd\u53ef\u4ee5\u7528\u8fd9\u4e9b\u57fa\u672c\u7684\u95e8\u6240\u7ec4\u6210\u3002<\/p>\n<p>\u6211\u4eec\u5c06\u4e0a\u9762\u6240\u7ed8\u5236\u7684\u7ebf\u8def\u5206\u89e3\u4e3a\u57fa\u672c\u7684\u95e8\uff0c\u91cf\u5b50\u7ebf\u8def\u56fe\u4e3a\uff1a<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"makefile\"><code><span class=\"code-snippet_outer\">circ_basis = circ.decompose()<\/span><\/code><code><span class=\"code-snippet_outer\">circ_basis.draw()<\/span><\/code><\/pre>\n<\/section>\n<p><img data-dominant-color=\"eeeeee\" data-has-transparency=\"true\" style=\"--dominant-color: #eeeeee;\" loading=\"lazy\" decoding=\"async\" class=\"has-transparency alignnone size-full wp-image-31187\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/11\/20261120073936218.png\" width=\"150\" height=\"92\" alt=\"\" \/><\/p>\n<p>\u5e76\u6d4b\u7b97\u5176\u8ba1\u7b97\u6df1\u5ea6\uff1a<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li>\u00a0<\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"bash\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__built_in\">print<\/span>(circ.depth(), <span class=\"code-snippet__string\">','<\/span>, circ_basis.depth())<\/span><\/code><\/pre>\n<\/section>\n<p>\u53ef\u6d4b\u5f97\u6df1\u5ea6\u5747\u4e3a5\u3002\u800c\u5bf9\u4e8e\u5176\u4ed6\u7684\u7ebf\u8def\u5b9e\u73b0\uff0c\u6709\u4e9b\u65f6\u5019\u771f\u6b63\u6267\u884c\u7684\u95e8\u7ebf\u8def\u6df1\u5ea6\u6bd4\u624b\u5de5\u7ed8\u5236\u51fa\u7684\u95e8\u7ebf\u8def\u6df1\u5ea6\u8981\u6df1\u3002\u53e6\u5916\uff0c\u53d7\u5230\u91cf\u5b50\u8ba1\u7b97\u82af\u7247\u81ea\u8eab\u7684\u62d3\u6251\u8fde\u63a5\u7ea6\u675f\uff0c\u8981\u6267\u884c\u67d0\u4e9b\u64cd\u4f5c\u65f6\u5f80\u5f80\u8fd8\u9700\u8981SWAP\u95e8\u6765\u5b9e\u73b0\u672a\u8fde\u63a5\u7684\u91cf\u5b50\u6bd4\u7279\u4e4b\u95f4\u7684\u4e92\u64cd\u4f5c\u3002<\/p>\n<p>\u6267\u884c\u5e26\u6d4b\u91cf\u7684\u91cf\u5b50\u7ebf\u8def\uff1a<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"makefile\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Import Aer<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">from qiskit import Aer<\/span><\/code><code><span class=\"code-snippet_outer\">from qiskit.visualization import plot_histogram<\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Run the quantum circuit on a qasm simulator backend<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">backend = Aer.get_backend(qasm_simulator')<\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Create a Quantum Program for execution <\/span><\/span><\/code><code><span class=\"code-snippet_outer\">job = execute(circ, backend)<\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\">counts = job.result().get_counts()<\/span><\/code><code><span class=\"code-snippet_outer\">print(counts)<\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\">plot_histogram(counts,\u00a0figsize=(15,6))<\/span><\/code><\/pre>\n<\/section>\n<p>\u7ed3\u679c\u5982\u4e0b\u6240\u793a\u3002\u53ef\u4ee5\u770b\u51fa\u7ecf\u8fc7\u51e0\u6b21\u91cf\u5b50\u64cd\u4f5c\u4e4b\u540e\uff0c\u91cf\u5b50\u6bd4\u7279\u7684\u72b6\u6001\u5927\u7ea650%\u5904\u4e8e|0000&gt;\u6001\uff0c50%\u5904\u4e8e|1111&gt;\u6001\u3002<\/p>\n<p><img data-dominant-color=\"b7c9f7\" data-has-transparency=\"false\" style=\"--dominant-color: #b7c9f7;\" loading=\"lazy\" decoding=\"async\" class=\"not-transparent alignnone size-full wp-image-31188\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/11\/20261120073936951.png\" width=\"150\" height=\"65\" alt=\"\" \/><\/p>\n<p>\u5b9e\u9a8c\u7ed3\u679c\u4e0eTU Delft\u7684qx\u91cf\u5b50\u6a21\u62df\u5668\u7ed3\u679c\u4e00\u81f4\u3002<\/p>\n<p><img data-dominant-color=\"37142c\" data-has-transparency=\"true\" style=\"--dominant-color: #37142c;\" loading=\"lazy\" decoding=\"async\" class=\"has-transparency alignnone size-full wp-image-31189\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/11\/20261120073936940.png\" width=\"150\" height=\"80\" alt=\"\" \/><\/p>\n<p>\u63a5\u4e0b\u6765\u4e3a\u91cf\u5b50\u7ebf\u8def\u7684\u589e\u52a0\u8bfb\u53d6\u566a\u58f0:<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<li>\u00a0<\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"properties\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Import Aer<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attr\">from<\/span> <span class=\"code-snippet__string\">qiskit import Aer<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attr\">from<\/span> <span class=\"code-snippet__string\">qiskit.visualization import plot_histogram<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attr\">from<\/span> <span class=\"code-snippet__string\">qiskit.providers.aer import noise<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Run the quantum circuit on a qasm simulator backend<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attr\">backend<\/span> = <span class=\"code-snippet__string\">Aer.get_backend('qasm_simulator')<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attr\">noise_model<\/span> = <span class=\"code-snippet__string\">noise.NoiseModel()<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attr\">for<\/span> <span class=\"code-snippet__string\">qi in range(4):<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__attr\">read_err<\/span> = <span class=\"code-snippet__string\">noise.errors.readout_error.ReadoutError([[0.9, 0.1],[0.25,0.75]])<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__meta\">noise_model.add_readout_error(read_err,<\/span> <span class=\"code-snippet__string\">[qi])<\/span><\/span><\/code><code>    <\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__comment\"># Create a Quantum Program for execution <\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attr\">job<\/span> = <span class=\"code-snippet__string\">execute(circ, backend,noise_model=noise_model)<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attr\">counts<\/span> = <span class=\"code-snippet__string\">job.result().get_counts()<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attr\">print(counts)<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><br \/><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__meta\">plot_histogram(counts,\u00a0figsize<\/span>=<span class=\"code-snippet__string\">(15,6))<\/span><\/span><\/code><\/pre>\n<\/section>\n<p>\u7ebf\u8def\u7684\u6267\u884c\u7ed3\u679c\u4e3a\uff1a<\/p>\n<p><img data-dominant-color=\"e7e9ef\" data-has-transparency=\"false\" style=\"--dominant-color: #e7e9ef;\" loading=\"lazy\" decoding=\"async\" class=\"not-transparent alignnone size-full wp-image-31190\" src=\"https:\/\/aiforumimage.oss-cn-shanghai.aliyuncs.com\/wp-content\/uploads\/2026\/11\/20261120073937665.png\" width=\"150\" height=\"65\" alt=\"\" \/><\/p>\n<p>\u4ece\u4e0a\u9762\u7ed3\u679c\u4e0d\u96be\u53d1\u73b0\uff0c\u566a\u58f0\u5bf9\u91cf\u5b50\u8ba1\u7b97\u7ed3\u679c\u7684\u51c6\u786e\u6027\u6709\u7740\u6781\u5927\u7684\u5f71\u54cd\u3002\u6211\u4eec\u77e5\u9053\uff0c\u91cf\u5b50\u8ba1\u7b97\u673a\u4e2d\u5e7f\u6cdb\u5b58\u5728\u7740\u5927\u91cf\u566a\u58f0\uff0c\u4f7f\u5f97\u91cf\u5b50\u8ba1\u7b97\u7684\u6700\u7ec8\u51c6\u786e\u5ea6\u96be\u4ee5\u5f97\u5230\u4fdd\u8bc1\u3002<\/p>\n<p>\u53c2\u8003\uff1a<\/p>\n<p>https:\/\/github.com\/Qiskit\/qiskit-tutorials\/tree\/stable\/0.12.x<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_31191\" class=\"pvc_stats total_only  \" data-element-id=\"31191\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/www.ixpower.cn\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u91cc\u4f7f\u7528\u7684\u64cd\u4f5c\u7cfb\u7edf\u73af\u5883\u4e3a64\u4f4d\u7684Ubuntu18.04.2 LTS\u3002 \u4e00\u3001\u5b89\u88c5\u76f8\u5173\u8f6f\u4ef6\u5305 1. \u5b89\u88c5\u914d\u7f6epyt [&hellip;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_31191\" class=\"pvc_stats total_only  \" data-element-id=\"31191\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/www.ixpower.cn\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":471,"featured_media":31190,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"publish_to_discourse":"","publish_post_category":"","wpdc_auto_publish_overridden":"","wpdc_topic_tags":"","wpdc_pin_topic":"","wpdc_pin_until":"","discourse_post_id":"","discourse_permalink":"","wpdc_publishing_response":"","wpdc_publishing_error":"","footnotes":""},"categories":[2325],"tags":[],"class_list":["post-31191","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-2325"],"_links":{"self":[{"href":"https:\/\/www.ixpower.cn\/index.php\/wp-json\/wp\/v2\/posts\/31191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ixpower.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ixpower.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ixpower.cn\/index.php\/wp-json\/wp\/v2\/users\/471"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ixpower.cn\/index.php\/wp-json\/wp\/v2\/comments?post=31191"}],"version-history":[{"count":1,"href":"https:\/\/www.ixpower.cn\/index.php\/wp-json\/wp\/v2\/posts\/31191\/revisions"}],"predecessor-version":[{"id":31193,"href":"https:\/\/www.ixpower.cn\/index.php\/wp-json\/wp\/v2\/posts\/31191\/revisions\/31193"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ixpower.cn\/index.php\/wp-json\/wp\/v2\/media\/31190"}],"wp:attachment":[{"href":"https:\/\/www.ixpower.cn\/index.php\/wp-json\/wp\/v2\/media?parent=31191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ixpower.cn\/index.php\/wp-json\/wp\/v2\/categories?post=31191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ixpower.cn\/index.php\/wp-json\/wp\/v2\/tags?post=31191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}