Placeholder Image

字幕列表 影片播放

  • - So let's get started.

  • - [Paul] That was good, but the screen

  • turned off in the middle of it.

  • - [Grunts comically]

  • - [Paul] All right, let's do the intro.

  • [Upbeat Music]

  • - [Abe] Hello again.

  • This is Abe and welcome back

  • to Coding with Qiskit.

  • In this episode, we're going to install Qiskit

  • on our computer and get started writing code.

  • Now we're going to make sure

  • that you're ready to go whether you're using a Mac,

  • a Windows machine, or a Linux machine.

  • So we're going to achieve two things.

  • The first thing that we're going to do

  • is first set up Qiskit on our computer

  • and then what we're going to do is

  • get an access token from the IBM Quantum Experience.

  • So that access token allows us to write code

  • that we can then run, not just locally on our computers

  • but also on real quantum computers at IBM.

  • So in order to install Qiskit,

  • the first thing I'm going to do

  • is make sure that I have all

  • the requirements ready.

  • And to do this, I'm going to install

  • a distribution of Python called Anaconda Python.

  • Now I'm going to be installing things

  • on a Mac so every time I see a step

  • that requires a little bit of attention,

  • if you're on Windows or on Linux machines,

  • I'll point those out.

  • So we start off by opening a new browser window

  • and typing in: Anaconda Python.

  • This will take us to a distribution page

  • for Anaconda Python which allows me to now

  • install it on my computer.

  • As I said, I'm using a macOS right now

  • but if you're on a Windows machine

  • or a Linux machine, you'd have to change

  • depending on which set-up you'd like to use.

  • Now one thing I'd like to point out here,

  • is that if you're on a Windows machine,

  • what you are downloading is an executable

  • which will then install Anaconda on your computer.

  • If you're on a Linux machine,

  • you're downloading an .sh file.

  • So let's do the macOS installation.

  • And a key thing to remember here is

  • we're going to be using Python 3.7.

  • There is another distribution for 2.7

  • but we're not going to be using that.

  • So let's go to the Python 3.7 version

  • and click Download.

  • As you might imagine,

  • the download will take a few moments

  • so this is a good point to pause the video

  • and come back to it once your download is complete.

  • Once the download is complete,

  • I'm going to go to my Downloads folder

  • and click the Anaconda package.

  • I'm going to click Continue on this step

  • and then follow the installation instructions.

  • So usually the default settings are good enough

  • so I'm just going to do this very quickly.

  • And as this installation is proceeding,

  • I would like to remind you again,

  • if you're on a Windows machine,

  • you would go to your Downloads folder

  • and run the executable for the Anaconda distribution

  • and if you're on a Linux machine,

  • you're going to open your terminal,

  • switch to that folder, your Downloads folder,

  • and then type: bash, along with the name

  • of the file that you downloaded.

  • As of this video, it was an .sh file.

  • So once the installation completes,

  • I'm going to close

  • and start my terminal.

  • And then install Qiskit by typing in: pip install qiskit.

  • So this procedure is the same on all devices.

  • On Windows machine, you would open the Anaconda Prompt.

  • So go to your Start Menu and type: Anaconda Prompt.

  • Open that terminal window and type: pip install qiskit

  • and on a Linux machine, you'd do exactly

  • what we did here which is open your terminal

  • and type: pip install qiskit

  • so similar instruction on all three operation systems.

  • All right, and once that's done,

  • we're ready to start using Qiskit.

  • So what I'm going to do is

  • use the Jupyter Notebook interface

  • to write Qiskit code

  • so while we're in this terminal window,

  • what I'm going to do is type: jupyter notebook.

  • Notice how the spelling of Jupyter

  • has a Y in it.

  • Once I do that, Jupyter opens in a new browser window

  • and you get something that looks like this.

  • So the first thing to do,

  • is create a new Jupyter notebook

  • based on Python 3.

  • And this is what the page looks like.

  • So the first thing I'm going to do

  • is make sure that my Qiskit installation

  • is complete.

  • So what I'm going to do

  • is write some Python code to import Qiskit here.

  • And that's going to say: import qiskit

  • and hit Shift plus Enter.

  • If you have Qiskit installed,

  • this line should execute and you should see that line

  • go from In to In 1.

  • And to make sure that the version of Qiskit

  • is the latest version,

  • I'm going to type: qiskit.__qiskit_version__

  • When you do that, you should see an output

  • that tells you the version of Qiskit

  • that you have installed.

  • As of this video, the version of Qiskit

  • that's the latest is 0.11.1

  • and the versions that you see under that

  • are the components of Qiskit.

  • The four elements that we'll be talking about

  • throughout this video series.

  • Remember that Qiskit is open source software

  • so what you can do is go to Qiskit.org,

  • find the link to our GitHub page,

  • go to the Qiskit repository

  • and scroll down in the ReadMe

  • and see what release version there is.

  • So as you see, this is release 0.11.1

  • which is exactly what we're seeing

  • in our Jupyter notebook.

  • So we're up to date and we're ready to start

  • writing code.

  • While we write our code,

  • what we will usually do is first,

  • debug our code on a simulator

  • and once we're ready to run our code

  • we'll send it to a quantum device.

  • In order to use the quantum devices at IBM,

  • we need to get an API token

  • which gives us permission to use the devices.

  • So to get that API token,

  • we need to create an account

  • on the IBM Quantum Experience website.

  • That website is quantum-computing.ibm.com.

  • Once you get to the website,

  • you need to create a new account,

  • if you don't have an account.

  • Once you log into the IBM Quantum Experience website,

  • you should be seeing a page that looks similar

  • to this.

  • So this website allows you to first,

  • create a quantum circuit graphically

  • by using, what we call a circuit composer

  • or to use online Qiskit notebooks

  • by going to the left side and clicking

  • Qiskit Notebooks

  • or by going to the homepage

  • and clicking Create a notebook.

  • So you can think of this

  • as a way of running Jupyter notebooks

  • online with Qiskit installed

  • just like we did on our local computer.

  • In order to get your API token,

  • remember this is your access code

  • to IBM's quantum devices.

  • You would go to your profile page

  • by clicking this top right bar

  • and clicking My Account.

  • And this is your API token.

  • So it's hidden from view, you'd click Copy Token.

  • On the Jupyter notebook, we're going to type:

  • from qiskit import IBMQ

  • and hit Shift, Enter to execute that line

  • and then we're going to type: IBMQ.save_account

  • and then within single quotes

  • I'm going to type in my API token

  • that I pasted from that website.

  • Once you do this,

  • your API token is saved onto your computer

  • and now you're ready to access IBM's quantum devices.

  • To see that you have access to these devices,

  • what you can do is then type: IBMQ.load account.

  • Once this line executes,

  • you should see an output that tells you

  • the account that you have access to

  • and you should be able to proceed

  • with running code, not just on your computer,

  • but then sending the quantum circuits

  • that you build in your computer

  • to IBM's quantum devices and getting results

  • back from them.

  • So now that you've installed Qiskit,

  • you're ready to start writing code

  • and building your quantum circuits

  • and executing them, both on simulators

  • and on quantum hardware.

  • This is the exciting part,

  • where you get to build,

  • not just things to test on your computer,

  • but to deploy in a lab at IBM and get results back

  • and these could be games.

  • These could be applications for industry

  • or even things you personally are interested in.

  • We'll start off in the next episode

  • by showing you how to run a simple quantum circuit,

  • both on a simulator on your computer

  • and on the hardware at IBM.

  • If at any point, you had trouble installing Qiskit

  • please feel free to reach out to us

  • on our Qiskit Slack channel

  • where you can get support.

  • Not just from IBM but also from people

  • in the community.

  • We'll post a link to the Slack channel

  • down in the description.

  • [Upbeat Hip Hop]

- So let's get started.

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

B1 中級 中文 美國腔

如何安裝Qiskit-在Quantum Computers 上編程 第2集(How to Install Qiskit — Programming on Quantum Computers Season 1 Ep 2)

  • 12 1
    葉羽修 發佈於 2024 年 03 月 14 日
影片單字