I am on MAC Pro running MAC OS Siera 10.12.6 and have installed Python 3.6.4 however when i run idle I get this message WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable. Vim is amongst the top 5 in our list of the best text editors for Python. It is a modal editor that splits file viewing from file editing. It’s a huge step ahead of the initial Vi, with more powerful features. Compatibility: Windows, Linux, Mac OS, IOS, Android, UNIX, AmigaOS, and MorphOS.
How to download adobe xd for mac free. 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. All of the software is freely available on the Web. These instructions are for MacOS X 10.13 (High Sierra), but the instructions for other recent versions of Mac OS X are similar.
Installing Matplotlib on your Mac or Windows Laptop First install Python 3.x: Even if you have an older version of Python, e.g., Python 3.2, on your laptop, you can still install a newer version, e.g., 3.5 or 3.6. On your Windows machine download and install the latest Python 3 Release from Python. Installing Pygame for Python 3 on Mac and Linux 11 4. Hen the Pygame installation completes, open a file window W and go to Applications4 Programming4IDLE (using Python-3.4) to open the IDLE Python shell. Test your installation of Pygame for Python 3 on Linux by typing import pygame and pressing enter at the prompt, as shown in Figure 13. Head to python.org. Click 'Downloads', then download the latest version from there: This downloads the appropriate 64-bit version of the latest Python release (3.9.6 as of August 2021). NOTE: If your Mac's OS version is older than 10.9 (year 2013), I recommend upgrading your OS first.
Download Python Mac
In the stock Mac OS X python installation, idle is found in /usr/bin, which is not (easily) accessible from Finder and not indexed by Spotlight. The quickest option is to open the Terminal utility and type 'idle. NOTE: If your Mac's OS version is older than 10.9 (year 2013), I recommend upgrading your OS first. If you are unable to, see this FAQ for how to install Python on an older version of Mac OS. Proceed with installation. If everything goes fine, you should see an IDLE shortcut in your Launchpad. Go ahead and try it out! Video tutorial here. If you want the latest version on Mac OS X, you can always grab it from Python.org MAC OS X downloads. For Linux, upgrading Python depends on your Linux distribution. Microsoft Windows 10 doesn’t come with Python pre-installed, so we’ll have to install it ourselves. Head over to Python.org downloads and download the installation file. It also affects the Built-in 8.5.x Tcl/Tk included with pre-release python.org 3.4.x installers. It appears that the problem does not affect the Apple Tk 8.5.9 shipped with OS X 10.9, which is used by the system Pythons included in OS X 10.9.
Overview
The Python programming environment required by this booksite consists of:
- Python, that is, the Python compiler/interpreter.
- The Python standard libraries.
- IDLE, the Python Integrated DeveLopment Environment.
- The Tkinter, NumPy, and Pygame libraries, which are used by the booksite programs that do graphics or audio processing.
- The booksite library, that is, a set of modules that we developed specifically to support this booksite.
- The Terminal application that is bundled with Mac OS X.
Downloading and Installing Python, IDLE, Tkinter, NumPy, and Pygame
Note: The Mac Finder application uses the term folder to mean a container of documents and, perhaps, other folders. This document instead uses the equivalent Unix term directory. |
Python 2 is bundled with Mac OS X. However, Python 3 is not. We recommend that you download and install Python 3, and use Python 3 exclusively when running programs associated with this booksite.
Perform these steps to download and install Python, IDLE, Tkinter, NumPy, and PyGame:
Browse to the Python for Mac download page.
In the resulting page click on the Download Python 3.6.5 button. Your browser will download the file
python-3.6.5-macosx10.6.pkg
to yourDownloads
directory.Using Mac Finder Manager, navigate to your
Downloads
directory, and double-click on thepython-3.6.5-macosx10.6.pkg
file to install Python, Tkinter, and IDLE. Use the default options. (It's OK to delete thepython-3.6.5-macosx10.6.pkg
file after the installation is complete.)Open a Terminal window. To do that, click on the Spotlight Search icon on the right end of the menu bar. (It has the appearance of a magnifying glass.) In the resulting dialog box, type
Terminal.app
followed by the Enter key.In the Terminal window issue these commands to install NumPy and PyGame:
To 'issue a command' you should type the command followed by the Enter key. |
Perform these steps to test your installation:
In the Terminal window issue the
python3
command. You should see something like this:If you see that output, then your installation of Python, IDLE, and Tkinter was successful.
At the Python
>>>
prompt, typeimport numpy
followed by theEnter
key. If no error messages appear, then your installation of NumPy was successful.At the Python
>>>
prompt, typeimport pygame
followed by theEnter
key. If no error messages appear, then your installation of PyGame was successful.At the Python
>>>
prompt, typeexit()
followed by theEnter
key to exit Python.- In the Terminal window issue the command
idle3
. If an IDLE window appears, then you have installed IDLE properly. Close the IDLE window. Close the Command Prompt window.
IMPORTANT: When running the Python programs associated with this booksite, do not issue the python command. Instead issue the python3 command. The former command runs the Python 2 compiler/interpreter that is bundled with Mac OS X; the latter command runs the Python 3 compiler/interpreter that you installed by following the instructons on this page. |
Downloading and Installing the Booksite Library
Perform 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.In the Finder, double click on
/Users/yourusername/Downloads/introcs-1.0.zip
to unzip the file, thus creating a directory named/Users/yourusername/Downloads/introcs-1.0
. (It's OK to delete the/Users/yourusername/Downloads/introcs-1.0.zip
file after you have unzipped it.)Open a Terminal window.
At any time the Terminal application has a working directory. Initially the working directory is
/Users/yourusername
. In the Terminal window issue thecd Downloads
command to change your working directory to/Users/yourusername/Downloads
, and then issue thecd introcs-1.0
command to change your working directory to/Users/yourusername/Downloads/introcs-1.0
. (Incidentally, thecd .
command changes your working directory to the 'parent' of the current working directory.)Issue the
ls
command to display the names of all files in your working directory. Make sure that a file namedsetup.py
is in your working directory.Issue the
python3 setup.py install --user
command. 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
python3
command.At the Python
>>>
prompt, type the statementimport stdio
followed by the Enter key. If Python generates no error messages, then you have installed the booksite library properly.At the Python
>>>
prompt, typeexit()
followed by the Enter key to exit Python.Close the Terminal window.
Configuring IDLE
So far you've downloaded and installed all of the software that you'll need. You should perform one more step before creating your first program: configure the IDLE programming environment. Follow these instructions:
Open a Terminal window.
In the Terminal window issue the command
idle3
to launch IDLE.Click on the Python → Preferences. menu item.
Click on the General tab.
Click on the Open Edit Window radio button.
Click on the Ok/photoshop-for-mac-os-lion-download/. button.
Close the IDLE window.
Close the Terminal window.
Composing Your First Program
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. Perform these instructions:
Using the Mac Finder, create a directory named
/Users/yourusername/hello
.Open a Terminal window.
Issue the
cd hello
command to make the/Users/yourusername/hello
directory your working directory.Issue the command
idle3 &
to launch IDLE. Note the trailing ampersand. The trailing ampersand tells the computer to run theidle3
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. Use the arrow keys, mouse, or touchpad to move within the text that you have typed. Use the Delete key to delete text. Be careful; the smallest typing mistake might cause the program to fail.
When you are finished typing, in IDLE click on the File → Save. menu item to save the Python program. Save it in a file named
helloworld.py
in the directory/Users/yourusername/hello
. The file name is case sensitive, so make sure you use all lowercase letters.
Running Your First Program
The final step is to run your program. 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. 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. Confirm that the working directory contains yourhelloworld.py
file.Issue the
python3 helloworld.py
command to run your program. If the computer writes 'Hello, World' to the Terminal window, then the execution of yourhelloworld.py
program was successful. If the computer instead writes error messages, then use IDLE to correct your program, and issue thepython3 helloworld.py
command again. Repeat until your program runs successfully. If your program runs successfully the first time you try, then intentionally introduce an error into your program, just so you get some experience with correcting errors.Close the IDLE window.
Close the Terminal window.
Idle Python Mac Download
You now have installed and configured a reasonable Python environment, and have used it to compose and run a Python program. Congratulations! You are a Python programmer!
Downloading the Booksite Example Programs (optional)
Python For Mac Os
We recommend that you download the booksite example programs, that is, the example Python programs that are presented incrementally throughout the booksite. Having done so, you can run those programs to help you learn about them. Perform these instructions:
Use your Web browser to download this introcs-python.zip file to your
/Users/yourusername/Downloads
directory.In the Mac Finder, double-click on
/Users/yourusername/Downloads/introcs-python.zip
to unzip the file, thus creating the/Users/yourusername/Downloads/introcs-python
directory containing the booksite example programs. (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:
Open a Terminal window.
Issue the
cd Downloads
andcd introcs-python
commands to make/Users/yourusername/Downloads/introcs-python
your working directory.Issue the
ls
command. Confirm that the working directory contains a file namedbouncingball.py
.Issue the
python3 bouncingball.py
command. If Python launches a stddraw window showing an animated bouncing ball, then your download of the booksite example programs was successful.Close the stddraw window.
Close the Terminal window.
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. 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
/Users/yourusername/Downloads/introcs-data.zip
to unzip the file, thus creating the/Users/yourusername/Downloads/introcs-data
directory containing the booksite example data files. (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. Now 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. Perform these instructions:
Use your Web browser to download this stdlib-python.zip file to your
/Users/yourusername/Downloads
directory.In the Mac Finder, double-click on
/Users/yourusername/Downloads/stdlib-python.zip
to unzip the file, thus creating the/Users/yourusername/Downloads/stdlib-python
directory containing the booksite library. (It's OK to delete the/Users/yourusername/Downloads/stdlib-python.zip
file after you have unzipped it.)
We invite you to study the code that implements the booksite library. But don't be concerned if some of the code is cryptic. The code that implements the booksite library uses some features of Python that are beyond the scope of the textbook and this booksite.
Q & A
Q. Why do I get the error ImportError: No module named stdio
when I issue the command python program_that_uses_stdio.py
?
A. You must issue the command python3 program_that_uses_stdio.py
, as described above.
Q. I downloaded files using my browser, but can't find them. Where are they?
A. Many browsers by default place downloaded files in the directory /Users/yourusername/Downloads
.
Q. How do I break out of an infinite loop when running my program from the Terminal application?
A. Type Ctrl-c. That is, while pressing the Ctrl key, type the c key.
Q. Must I use IDLE to create my Python programs? Can I use some other text editor?
A. You need not use IDLE to create your Python programs; it is fine to use some other text editor. For example, it is reasonable to use the TextEdit editor that is bundled with Mac OS X. However if you do use some other text editor, then make sure you change its settings so it (1) uses a four-space indentation scheme, and (2) indents using spaces instead of tabs. The Wikipedia Comparison of text editors page provides summary descriptions of many text editors.
Python is a popular programming language that is widely used by both beginners and professional developers. Modern versions of Mac OS support Python 2.7.x (or Python 2.6.1 in older versions), but many users need to upgrade to Python 3.6 or 3.7.
Today I will explain how to install the Python 3 update on a Mac in two different ways.
Note that I mean “install update” rather than “upgrade”, since Python 2 will remain on the Mac with this method. Some Mac programs require Python 2, and when upgrading they may start to malfunction or stop working altogether. Therefore, we will not update the installed version, but install Python 3 in parallel. Python 3 and Python 2 can coexist on the same Mac without conflicts, just the commands will differ slightly.
How to install Python 3 in macOS with Installer
The easiest way is to download the Python installer from the python.org website.
Mac Os Python Version
- Visit Python.org and download the latest available Python installer file;
- Run the downloaded file and install Python 3.x on Mac.
- Python 3.6.x requires about 100MB of available disk space. The installation process is very fast;
- When Python 3 is installed, you will see the Python3 folder in /Applications on your Mac. You will also see IDLE in the /Applications.
Next method will show you how to install Python 3.x on a Mac through Homebrew.
Idle For Mac
How to install Python 3 using Homebrew
Installing an updated version of Python 3 through Homebrew is extremely simple. Of course, Homebrew should be installed on your computer, however, if you are interested in this method, then you probably have already used the program more than once.
Python Download Mac Os
Read more:How to Format USB for macOS and Windows?
If you haven’t Homebrew in your system, you can take script for Homebrew installing here. This script installs Homebrew to /usr/local so that you don’t need “sudo” when you brew install. It is a careful script; it can be run even if you have stuff installed to /usr/local already. It tells you exactly what it will do before it does it too. You have to confirm everything it will do before it starts.
Now to install Python 3 via Homebrew, run the following command in Terminal:
When Python 3 is installed on a Mac, you can start the program with:
In any case, after installing Python 3 on a computer, the version of Python 2.7 will still remain on it, and you will be able to use it.
How to Find out the Installed Version of Python
Open the Terminal program and use the following command:
In most cases, Python 2.7.x will be installed on macOS: either 2.7.4 or 2.7.10.
If you installed the Python update, you can check the version with the following command:
Once again, both versions of Python can coexist without conflicts.
Note: Once again, I want to remind you that you do not need to upgrade Python 2.x to Python 3.x, because this can lead to program malfunctions. Just install the updated version in parallel.
Mac OS X comes with Python 2.7 out of the box.
You do not need to install or configure anything else to use Python 2. Theseinstructions document the installation of Python 3.
The version of Python that ships with OS X is great for learning, but it’s notgood for development. The version shipped with OS X may be out of date from theofficial current Python release,which is considered the stable production version.
Doing it Right¶
Let’s install a real version of Python.
Before installing Python, you’ll need to install GCC. GCC can be obtainedby downloading Xcode, the smallerCommand Line Tools (must have anApple account) or the even smaller OSX-GCC-Installerpackage.
Note
If you already have Xcode installed, do not install OSX-GCC-Installer.In combination, the software can cause issues that are difficult todiagnose.
Note
Python Idle Download 3.9
If you perform a fresh install of Xcode, you will also need to add thecommandline tools by running xcode-select--install
on the terminal.
While OS X comes with a large number of Unix utilities, those familiar withLinux systems will notice one key component missing: a package manager.Homebrew fills this void.
To install Homebrew, open Terminal
oryour favorite OS X terminal emulator and run
The script will explain what changes it will make and prompt you before theinstallation begins.Once you’ve installed Homebrew, insert the Homebrew directory at the topof your PATH
environment variable. You can do this by adding the followingline at the bottom of your ~/.profile
file
If you have OS X 10.12 (Sierra) or older use this line instead
Now, we can install Python 3:
This will take a minute or two.
Pip¶
Homebrew installs pip
pointing to the Homebrew’d Python 3 for you.
Working with Python 3¶
At this point, you have the system Python 2.7 available, potentially theHomebrew version of Python 2 installed, and the Homebrewversion of Python 3 as well.
will launch the Homebrew-installed Python 3 interpreter.
will launch the Homebrew-installed Python 2 interpreter (if any).
Python Idle Download Mac
will launch the Homebrew-installed Python 3 interpreter.
If the Homebrew version of Python 2 is installed then pip2
will point to Python 2.If the Homebrew version of Python 3 is installed then pip
will point to Python 3.
The rest of the guide will assume that python
references Python 3.
Pipenv & Virtual Environments¶
The next step is to install Pipenv, so you can install dependencies and manage virtual environments.
A Virtual Environment is a tool to keep the dependencies required by different projectsin separate places, by creating virtual Python environments for them. It solves the“Project X depends on version 1.x but, Project Y needs 4.x” dilemma, and keepsyour global site-packages directory clean and manageable.
For example, you can work on a project which requires Django 1.10 while alsomaintaining a project which requires Django 1.8.
So, onward! To the Pipenv & Virtual Environments docs!
This page is a remixed version of another guide,which is available under the same license.