课程: Building and Deploying Deep Learning Applications with TensorFlow

Install TensorFlow on Windows

- To work with the code examples in this course, we need to install the Python 3 programming language, the PyCharm development environment, and several software libraries including TensorFlow. This video will cover installation on Windows. If you're using Mac OS, watch the separate video covering Mac installation instead. The method we'll use to install TensorFlow in this video will only install the core TensorFlow libraries. It won't install the additional components needed to take advantage of a video card's GPU to accelerate processing. Using a GPU requires special hardware and won't be needed for this course, but if you would like to install TensorFlow with GPU support, please refer to the more detailed instructions on the TensorFlow website for the additional steps you'll need to follow. First, let's install Python 3. On Windows, we'll be using the Anaconda distribution of Python. Many Python machine learning libraries were first developed for Linux, and they can be difficult to install correctly on Windows. Anaconda provides pre-packaged versions of Python machine learning libraries, which makes installation on Windows a lot easier. We're at the continuum.io website. Click download Anaconda. Since we're using Windows, we'll choose to download the Windows version. Click. Now we have the choice between Python 3 and Python 2. Click to download Python 3. Now that the download is finished, let's launch the installer. Click run. We can accept all the default options. Next. And install. When we downloaded Anaconda, we had the choice between Python 2 and Python 3. Python 3 is the newer version of Python that has several nice improvements, like better support for working with texts in other languages. So that's what we'll use for this course, and what I'd recommend you use for your own projects, but sometimes you might see code online written for Python 2 that hasn't been updated for Python 3. In that case, you can install Python 2 using the same process. You can have both versions installed at the same time. Great, the installation is complete. Click Next, and uncheck, and Finish. Now we need to install PyCharm. PyCharm is an integrated development environment for Python. Go to jetbrains.com/PyCharm. Okay, click Download Now, and then make sure you've chosen the Windows version. We have the choice of downloading the community edition or the professional edition. Either will work, but the community edition is free and has all the features we need, so let's download the community edition. Click. Alright, click and launch the installer. Click Run. We can accept all the defaults. Click Next, and Next, and Install. Great, it's done. Let's click to run PyCharm, and Finish. The first time we launch PyCharm, it'll ask us some questions. We can just accept the defaults, and click Accept, and OK. Now we are ready to create a project. Click Create New Project. When we create the project, choose the folder where you've downloaded the exercise files if you have them available. Okay. Next we need to configure the Python interpreter. By default, Anaconda has installed 3.6 for us here. But currently, TensorFlow on Windows only works with Python 3.5, so we need to install that as well. Click on the gear icon, and click Create Conda Environment. For the name, let's call it TensorFlow. For the Python version, make sure you've chosen 3.5, and then click OK. Now PyCharm will configure Python 3.5 for us. Okay, now click Create. And then click Yes to confirm. And close. Before we continue, we need to take a little detour to manually install TensorFlow. Because of the way it's distributed for Windows, we need to install it from the command line. To do that, let's open up the search bar and run the Anaconda Prompt application. Now we are at a Command Prompt. The first step is to activate the Python 3.5 environment that we just created so that TensorFlow gets installed into the correct place. To do that, type "activate TensorFlow" and hit enter. Now we're ready to install TensorFlow. The easiest way to do this is to cut and paste the command from the TensorFlow website. Let's go back to the TensorFlow website, click on Install, and then we're going to click Installing TensorFlow on Windows, and then we're going to scroll down until we get to the section that says Installing with Anaconda, and then finally we're going to copy the command from number 4, under installing the CPU-only version of TensorFlow. So I'm going to cut and paste this command into the Command Prompt application. Control + C, and then now I'm going to tap the Command Prompt, and then right click to paste and hit Enter. Great, when it says everything was successfully isntalled, you can close the Command Prompt window. Now let's switch back to PyCharm. Let's open up one of the source files in PyCharm. Click on Exercise Files, and 02, and addition final.py. As soon as we open the file, PyCharm will tell us that some of the package requirements are still missing. These are the other machine learning libraries we'll be using in the course. Click Install requirements, and then click Install. You might receive this error that says the package google-api-python-client is not satisfied. That's okay, we can work around this. First, let's use the search bar to open up the Anaconda prompt again. Next, let's type "activate TensorFlow," and hit Enter. Then we can manually install the package with this command, "conda install -c conda-forge," and then the name of the package, which is google-api-python-client. Then hit Enter. Then hit Enter to proceed. Great, now everything is ready to go.

内容