<chapter 2>2-1-1. Installing the Python SDK

Source: Internet
Author: User

APP engine contains two Python runtime environments: a traditional Python2.5-based environment, and a new environment for running Python2.7. This new environment is more than just a slight new version of the Python interpreter. Primarily, this new environment can serve multiple requests from a single application instance at the same time (serve multiple requests). This is a performance-related feature that is useful when you start to have large traffic. If you create a new app, there's no reason not to Python2.7. If you have an old app that uses the PYTHON2.5 runtime environment. You should consider updating. We assume that this and the remainder of the book use 2.7 environments.

The app Engine SDK for the Python runtime environment can run on any computer running Python2.7. If you're using Mac OS X or Linux, or if you've used Python before, it's likely that Python is already in your system. You can use the following command at the command line to test whether Python has been installed in your system, and which version is installed (command Prompt in Windows, Terminal (terminal) in Mac OS).

Python-v

(That's a capital ' V '.) If Python is installed, it prints its version number, like this:

Python 2.7.1

You can download and install the Python2.7 for your platform from the Python website.

http://www.python.org/

Make sure you get the Python2.7 version (such as Python 2.7.2) from the download area of the website. Until this book is written, Python's latest major version number is 3.2, and the latest 2.x compatible release board is 2.7.

※app Engine Python also does not support Python3.python 3, which contains new language and library features that are backward incompatible with earlier versions. When app engine increases support for Python 3, it is likely to become a new runtime environment outside of the Python2.5 and 2.7 environments. In the app's profile you can control which runtime environment your app uses. When the new run-time environment is published, your app will continue to run as expected.

You can download the corresponding App Engine Python SDK package for your operating system from the Google App engine website.

Http://developers.google.com/appengine/downloads

download and install the appropriate file for your operating system: <1.download and install the file appropriate for your operating system:>

? For the Windows,python SDK is an. msi (Microsoft Installer) file. Click the appropriate connection to download it, and then double-click the file to start the installation process. It installs the Google App Engine Launcher app, adds an icon to your Start menu, and adds a command line tool to the command path.

? For Mac OS X,python SDK is a Mac app in the. DMG disk image file. Click the connection to download it, and then double-click the file to mount the disk image (mount the disk image). Drag the Googleappenginelauncher icon to the app file. To install the command-line tool, double-click the icon to start launcher, allowing launcher to create a "symbolic link" (symlinks) when prompted.

? If you are using Linux or other platforms, the Python SDK can be obtained from the. zip package. Download and unzip (typically using the unzip command) to create a folder named Google_appengine. The command-line tools are present in this directory. Adjust your command path as needed.

In order to test the app Engine Python SDK is installed, run the following command on the command line:

dev_appserver.py--help

This command prints useful information. If you see a command that does not find the information, then check that the installer has completed successfully and that the location of the dev_appserver.py command is in your command path.

Windows user, if you run this command at the time, a containing "Windows cannot open this file ... In order to open this file, Windows needs to know what program created it's "information form opened up, you must tell Windows to open this file using Python." In this form, select Select an app from the list, and then click OK. Click Browse, and then locate your Python installation (for example: C:\Python27). Select Python from this folder, and then click Open. Select "Open this file with this selected program" and click OK. A window will open and run the command, and then it will be turned off immediately. Now you can run the command from the command line.

※please Make sure that launcher is using your Python2.7 settings and not other possible versions of your system before proceeding. In particular, the Mac version of Launcher will use/usr/bin/python2.6 by default, even when/usr/bin/python is Python2.7.

Change the python version used by launcher, select Reference (Preferences) from the appropriate menu, and then specify a/usr/bin/python "Python Path" value. Close this window to save the reference. If you have already run a development server, you need to restart it for the changes to take effect.

Verify that the launcher is using the correct Python version by opening the server and clicking the Logs button. Scroll to the top to see the "Python Command:/usr/bin/python" line. If this path setting does not take effect, close the launcher application and reboot.

Launcher Overview of the Tour

The version of the Python SDK for Windows and Mac OS X includes an app called Google app Engine Launcher (then "Launcher"). With this launcher, you can create and manage multiple app Engine Python projects from a graphical interface.

<chapter 2>2-1-1. Installing the Python SDK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.