But I do all my own personal Python stuff with 3.3. Your First Program in Python 2 on Mac OS XOS X (Mavericks) has Python 2.7 stock installed. Pip install ipython I am getting started with Python ΒΆ For new users who want to install a full Python environment for scientific computing and data science, we suggest installing the Anaconda or Canopy Python distributions, which provide Python, IPython and all of its dependences as well as a complete set of open source packages for.All of the software is freely available on the Web. This page tells you how to setup a Python programming environment for your Mac OS X computer and provides a step-by-step guide for creating and running a simple "Hello, world" Python program. Then the system will use the latest.In the Terminal window issue the cd Downloads command to change your working directory to /Users/ yourusername/Downloads, and then issue the cd introcs-1.0 command to change your working directory to /Users/ yourusername/Downloads/introcs-1.0. Initially the working directory is /Users/ yourusername. This document instead uses the equivalent Unix term directory.In the Finder, double click on the /Users/ yourusername/Downloads/introcs-1.0.zip file to unzip the file, thus creating a directory named /Users/ yourusername/Downloads/introcs-1.0.At any time the Terminal application has a working directory. If Python generates no error messages, then you have installed Pygame properly.At the Python > prompt, type exit() followed by the Enter key to exit Python.Downloading and Installing the Booksite LibraryPerform these steps to download and install the booksite library:Use your Web browser to download this introcs-1.0.zip file to your /Users/ yourusername/Downloads directory.Note: The Mac Finder application uses the term folder to mean a container of documents and, perhaps, other folders. You should see something like this:Python 2.7.10 (default, Oct 6 2017, 22:29:07) on darwinType "help", "copyright", "credits" or "license" for more information.If you see that output, then your Python compiler/interpreter is working, and Tkinter, numpy, and IDLE are available.At the Python > prompt, type the statement import pygame followed by the Enter key.Menu item.Click on the Open Edit Window radio button.Having installed Python, the Python standard libraries, IDLE, Tkinter, NumPy, Pygame, and the booksite libraries, and having configured IDLE, you are ready to compose your first Python program. Follow these instructions:In the Terminal window issue the command idle to launch IDLE.Click on the Python β Preferences. You should perform one more step before creating your first program: configure the IDLE programming environment. If Python generates no error messages, then you have installed the booksite library properly.So far you've downloaded and installed all of the software that you'll need. The computer copies the files defining the booksite modules to a directory where Python can find them, and writes status messages to your Terminal window to indicate its progress.Perform these steps to test your installation of the booksite library:In the Terminal window issue the python command.At the Python > prompt, type the statement import stdio followed by the Enter key. Make sure that a file named setup.py is in your working directory.Issue the python setup.py install -user command.
Menu item to save the Python program. Be careful the smallest typing mistake might cause the program to fail.# Write 'Hello, World' to standard output.When you are finished typing, in IDLE click on the File β Save. Use the Delete key to delete text. Use the arrow keys, mouse, or touchpad to move within the text that you have typed. The trailing ampersand tells the computer to run the idleX program in the background, thereby leaving your Terminal application free to handle additional commands while IDLE is running.In IDLE, type the four-line Python program helloworld.py exactly as it appears below. Note the trailing ampersand. Nxt program alpha rexConfirm that the working directory contains your helloworld.pyfile.Issue the python helloworld.py command to run your program. To do that, perform these steps:Within the same Terminal window, issue the ls command to display the names of all files in the working directory. It is possible to run some Python programs from within IDLE, but you should run the programs associated with this booksite directly from a Terminal window. The file name is case sensitive, so make sure you use all lowercase letters.The final step is to run your program. Pip For Pyton 2.7 On Code That ImplementsNow we describe how to download the booksite library so you can find it β for the sake of studying the code that implements it, should you so desire. (It's OK to delete the /Users/ yourusername/Downloads/introcs-data.zip file after you have unzipped it.)Downloading the Booksite Library: Part 2 (optional)Previously on this page we described how to download and install the booksite library so Python can find it. Perform these instructions:Use your Web browser to download this introcs-data.zip file to your /Users/ yourusername/Downloads directory.In the Finder, double-click on the /Users/ yourusername/Downloads/introcs-data.zip file, thus creating the /Users/ yourusername/Downloads/introcs-data directory containing the booksite example data files. If Python launches a stddraw window showing an animated bouncing ball, then your download of the booksite example programs was successful.Downloading the Booksite Example Data (optional)We recommend that you download the booksite example data, that is, the data files used by the booksite example programs that are presented incrementally throughout the booksite. Confirm that the working directory contains a file named bouncingball.py.Issue the python bouncingball.py command. (It's OK to delete the /Users/ yourusername/Downloads/introcs-python.zip file after you have unzipped it.)Then perform these steps to test your download of the booksite example programs:Issue the cd Downloads and cd introcs-python commands to make /Users/ yourusername/Downloads/introcs-python your working directory.Issue the ls command.
0 Comments
Leave a Reply. |
AuthorLatasha ArchivesCategories |