Current Instructions
These should work on both x86_64 and arm64 macs, running MacOS 10 and above
With dependencies installed with homebrew
1. Install Homebrew -- instructions found on link.
Install the SDL dependencies:
brew install sdl2 sdl2_image sdl2_mixer sdl2_ttf pkg-config
2. Install XQuartz [Seems to be optional]
brew install Caskroom/cask/xquartz
3. Install portmidi
This step is definitely optional, and may fail on your system (it fails on mine). If you don't run this, or it fails, pygame.midi won't work, which is fine for most people. (step 5, testing, will tell you if this worked or not).
brew install portmidi
4. Install latest Pygame from source
python3 -m pip install git+https://github.com/pygame/pygame.git
5. verify all Pygame Tests
python3 -m pygame.tests
Legacy Instructions
2017 instructions
Python3 and Pygame on macs can have a special setup. Try and follow the instructions on here, if you have the newest macOS. Make sure to follow the instructions designated for Python3. If those instructions don't work, click the source link on that answer, which goes to an article made for older macs.
Installing from source with homebrew
Homebrew is a package manager that's very popular on Mac. We use that to get the dependencies for pygame.
brew upgrade sdl sdl_image sdl_mixer sdl_ttf portmidi
python3.6 -m venv anenv
. ./anenv/bin/activate
pip install https://github.com/pygame/pygame/archive/master.zip
If you want to install the last release, change the pip install part to:
pip install https://github.com/pygame/pygame/archive/1.9.4.zip
Other instructions
The following page details how to install PyGame 1.9.1 on a Mac OS X 10.6 (Snow Leopard) running the most recent 2.x version of Python (2.7.1).
Here are some alternative methods for installing PyGame on osx:
Mountain Lion install instructions
1. Installed python but using visual python version. This is based on python 2.7.x
In my system this installs files under Applications and /Library/Frameworks/Python.framework
http://www.vpython.org
From this site:
First, download and install the pure 32-bit Python, Python-2.7.3
(VPython does not work with Mac 64-bit/32-bit Python, but this 32-bit version of Python works fine on 64-bit Macs)
Second, download and install VPython-Mac-Py2.7-5.74
This includes version 1.5.1 of numpy.
The download of Python-2.7.3 is from the vpython site and designed to work with vpython.
You can use the python installer from http://www.python.org. However, you will have to install numpy.
You can get numpy from http://sourceforge.net/projects/numpy/files/
2. Installed the SDL libraries from dmg
http://www.libsdl.org/
SDL 1.2.15
SDL_mixer 1.2.12
SDL_ttf 2.0.11
SDL_image 1.2.12
3. Installed the libjpeg and libpng libraries from dmg
http://ethan.tira-thompson.com/Mac_OS_X_Ports.html
libpng v1.5.4
libjpeg 8c
4. Installed Xcode 4.4 from Apple apps. Need to add command line tools.
To do this start Xcode and go to Preferences under Xcode menu. Choose the Download tab and select Components.
Then install the Command Line Tools.
5. Installed XQuartz. Mountain Lion OS X no longer includes the X11 window system library.
This is different from Lion OS X.
http://xquartz.macosforge.org/landing/
XQuartz-2.7.2.dmg
6. Downloaded pygame tar file from
http://pygame.org/download.shtml
pygame-1.9.1release.tar.gz
Decompressed and extracted to create directory pygame1.9.1release
6. Before compilation of pygame:
a. SDL_x header files refer to SDL as <SDL/SDL_yy.h> However, a SDL directory is not under
the include directory of SDL (SDL/Headers). To fix this in a simple way:
i. Went to directory
/Library/Frameworks/SDL.framework/Headers
then made a link as follows:
ln -s SDL ./
7. Changed to the pygame directory (normally pygame1.9.1release). Then switched to the super user.
However, you can use the sudo command instead.
I set the following compilation flags
export CC='/usr/bin/gcc'
export CFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -I/opt/X11/include -arch i386'
export LDFLAGS='-arch i386'
export ARCHFLAGS='-arch i386'
You must specify using the original location of X11. The mac does not have a ld.so.conf
and apparently the links generated by XQuartz in /usr do not work correctly.
8. Now execute:
python config.py
This should find the SDL, jpeg, png, and numpy libraries
python setup.py build
This will build in the directory before installing. It should complete with no errors.
then
python setup.py install
9. Confirmed that it worked:
Out of super user mode and in a terminal shell
python
and within python
import pygame
this gave no error and a simple pygame program ran fine.
GAMercier 2012-08-05
Snow leopard install instructions.
Set these environment flags before building...
export CC='/usr/bin/gcc-4.0' CFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch i386'
export LDFLAGS='-arch i386'
export ARCHFLAGS='-arch i386'
If you get this error:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
This link has a solution: http://packetcloud.net/2009/09/22/installing-mysql-python-module-for-python-262-on-snow-leopard-using-xcode/
download
first, get the following packages:
- The most recent PyGame from this site (currently 1.9.1): http://pygame.org/download.shtml
- The most recent PyObjC, (currently 2.2) Try `easy_install pyobjc==2.2` in terminal or download from the pyobjc site if that doesn't work - (Not needed in Mac OSX 10.5 Leopard - pyobjc 2.0 comes preinstalled)
- http://www.ijg.org/files/jpegsrc.v6b.tar.gz <-- BROKEN LINK !! ??
- http://downloads.sourceforge.net/numpy/Numeric-24.2.tar.gz
- http://downloads.sourceforge.net/libpng/libpng-1.2.16.tar.bz2
SDL frameworks
- http://www.libsdl.org/release/SDL-1.2.13.dmg
- http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.6.dmg
- http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.9.dmg
- http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-1.2.7.dmg
Tested with the latest python 2.7.x (2.7.1) framework:
Build and install
Install the SDL Frameworks
Open the DMG files and read the included Readme files to determine what needs to be moved where. The normal process is to go to each opened volume (/Volumes/SDL_something) directory, and run the appropriate following command:
sudo cp -R SDL.framework /Library/Frameworks/SDL.framework
sudo cp -R SDL_image.framework /Library/Frameworks/SDL_image.framework
sudo cp -R SDL_ttf.framework /Library/Frameworks/SDL_ttf.framework
sudo cp -R SDL_mixer.framework /Library/Frameworks/SDL_mixer.framework
Install pyobjc (non-Leopard only)
Unpack the tgz tar xvzf pyobjc-1.4.tar.gz cd pyobjc-1.4
Build and install python setup.py bdist_mpkg --open
Install Numeric
Unpack the tgz tar xvzf Numeric-24.2.tar.gz cd Numeric-24.2
In OSX Leopard, you will need to comment out three lines (152-154) in /Packages/RNG/Src/ranf.c //#if !defined(__sgi) // int gettimeofday(struct timeval *, struct timezone *); //#endif
Build and install sudo python setup.py install
Install Universal build libjpeg & libpng
pygame needs universal binaries to build right, but libpng and libjpeg sources don't build as universal binaries automatically... so you probably want to download the pre-built universal binaries for libpng & jpeg from ethan.tira-thompson.com. However you probably don't want to build against the dylib's for libpng and libjpeg if you are making an installer or will be using py2app, because then your distribution's imageext.so will not work without your clients also installing the libjpeg and libpng pacakges.
Since the package above installs both dylib and .a versions to /usr/local/lib and the build process will use the dylib versions by default, this means you probably want to delete/rename the dylib versions
Install the package
sudo rm /usr/local/lib/libpng.dylib sudo rm /usr/local/lib/libjpeg.dylib
Install libjpeg (from source)
Skip this step if you downloaded the pre-built universal binaries for libpng & jpeg
Unpack the tgz tar xvzf jpegsrc.v6b.tar.gz cd jpeg-6b
Build and install ./configure make sudo make install-lib
Install libpng (from source)
Skip this step if you downloaded the pre-built universal binaries for libpng & jpeg
Unpack the tbz
tar xvjf libpng-1.2.16.tar.bz2 cd libpng-1.2.16
Build and install
./configure make sudo make install
Install pygame
Unpack the tgz
tar xvzf pygame-1.8.0rc3.tar.gz cd pygame-1.8.0rc3
Configure python config.py
The output should be:
Using Darwin configuration...
Hunting dependencies...
Framework SDL found
Framework SDL_ttf found
Framework SDL_image found
Framework SDL_mixer found
Framework smpeg not found
NUMERIC : found 24.2
PNG : found
JPEG : found
Edit Setup and put a '#' at the start of the line: #scrap src/scrap.c $(SDL) $(X11)
Build pygame python setup.py build
Install pygame sudo python setup.py install
pygame with sdl2
Experimental sdl2 support can be compiled in like so:
brew install sdl2 sdl2_gfx sdl2_image sdl2_mixer sdl2_net sdl2_ttf
git clone https://github.com/pygame/pygame.git
cd pygame
python setup.py -config -auto -sdl2
python setup.py install
JAPANESE PATTERN-DESIGNER. JAPANESE PATTERN-DESIGNER. All that warm afternoon we paid the tiresome penalty of having pushed our animals too smartly at the outset. We grew sedate; sedate were the brows of the few strangers we met. We talked in pairs. When I spoke with Miss Harper the four listened. She asked about the evils of camp life; for she was one of that fine sort to whom righteousness seems every man's and woman's daily business, one of the most practical items in the world's affairs. And I said camp life was fearfully corrupting; that the merest boys cursed and swore and stole, or else were scorned as weaklings. Then I grew meekly silent and we talked in pairs again, and because I yearned to talk most with Camille I talked most with Estelle. Three times when I turned abruptly from her to Camille and called, "Hark!" the fagged-out horses halted, and as we struck our listening pose the bugle's faint sigh ever farther in our rear was but feebly proportioned to the amount of our gazing into each other's eyes. "I'm glad you didn't," Bruce smiled. "What a sensation those good people will have presently! And most of them have been on intimate terms with our Countess. My darling, I shall never be easy in my mind till you are out of that house." Those manifestations of sympathy which are often so much more precious than material assistance were also repugnant to Stoic principles. On this subject, Epict¨ºtus expresses himself with singular harshness. ¡®Do not,¡¯ he says, ¡®let yourself be put out by the sufferings of your friends. If they are unhappy, it is their own fault. God made them for happiness, not for misery. They are grieved at parting from you, are they? Why, then, did they set their affections on things outside themselves? If they suffer for their folly it serves them right.¡¯93 You are awfully good, Daddy, to bother yourself with me, when you're ¡°Some strong, pungent liquid had been poured on the green necklace,¡± the letter from the millionaire stated. ¡°No alarm was given. My wife did not want to broadcast either the fact that she had the real gems or the trouble in the hotel. But people had heard the ¡®fire!¡¯ cry and doubtless some suspected the possible truth, knowing why she was getting ready. ¡°But the switches that control the motor for the drum are right out on the wall in plain sight,¡± he told himself, moving over toward them, since the rolling door was left wide open when the amphibian was taken out. ¡°Yes, here they all are¡ªthis one up for lifting the door, and down to drop it. And that switch was in the neutral¡ª¡®off¡¯¡ªposition when we were first here¡ªand it¡¯s in neutral now.¡± The strong sense, lively fancy, and smart style of his satires, distinguished also Pope's prose, as in his "Treatise of the Bathos; or, the Art of Sinking in Poetry;" his "Memoirs of P. P., Clerk of this Parish"¡ªin ridicule of Burnet's "Own Times"¡ªhis Letters, etc. In some of the last he describes the country and country seats, and the life there of his friends; which shows that, in an age more percipient of the charm of such things, he would have probably approached nearer to the heart of Nature, and given us something more genial and delightful than anything that he has left us. The taste for Italian music was now every day increasing; singers of that nation appeared with great applause at most concerts. In 1703 Italian music was introduced into the theatres as intermezzi, or interludes, consisting of singing and dancing; then whole operas appeared, the music Italian, the words English; and, in 1707, Urbani, a male soprano, and two Italian women, sang their parts all in Italian, the other performers using English. Finally, in 1710, a complete Italian opera was performed at the Queen's Theatre, Haymarket, and from that time the Italian opera was regularly established in London. This led to the arrival of the greatest composer whom the world had yet seen. George Frederick Handel was born at Halle, in Germany, in 1685. He had displayed wonderful genius for music as a mere child, and having, at the age of seven years, astonished the Duke of Saxe Weissenfels¡ªat whose court his brother-in-law was a valet¡ªwho found him playing the organ in the chapel, he was, by the Duke's recommendation, regularly educated for the profession of music. At the age of ten, Handel composed the church service for voices and instruments; and after acquiring a great reputation in Hamburg¡ªwhere, in 1705, he brought out his "Almira"¡ªhe proceeded to Florence, where he produced the opera of "Rodrigo," and thence to Venice, Rome, and Naples. After remaining in Italy four years, he was induced to come to England in 1710, at the pressing entreaties of many of the English nobility, to superintend the opera. But, though he was enthusiastically received, the party spirit which raged at that period soon made it impossible to conduct the opera with any degree of self-respect and independence. He therefore abandoned the attempt, having sunk nearly all his fortune in it, and commenced the composition of his noble oratorios. Racine's "Esther," abridged and altered by Humphreys, was set by him, in 1720, for the chapel of the Duke of Chandos at Cannons. It was, however, only by slow degrees that the wonderful genius of Handel was appreciated, yet it won its way against all prejudices and difficulties. In 1731 his "Esther" was performed by the children of the chapel-royal at the house of Bernard Gates, their master, and the following year, at the king's command, at the royal theatre in the Haymarket. It was fortunate for Handel that the monarch was German too, or he might have quitted the country in disgust before his fame had triumphed over faction and ignorance. So far did these operate, that in 1742, when he produced his glorious "Messiah," it was so coldly received that it was treated as a failure. Handel, in deep discouragement, however, gave it another trial in Dublin, where the warm imaginations of the Irish caught all its sublimity, and gave it an enthusiastic reception. On its next presentation in London his audience reversed the former judgment, and the delighted composer then presented the manuscript to the Foundling Hospital, where it was performed annually for the benefit of that excellent institution, and added to its funds ten thousand three hundred pounds. It became the custom, from 1737, to perform oratorios[156] on the Wednesdays and Fridays in Lent. Handel, whose genius has never been surpassed for vigour, spirit, invention, and sublimity, became blind in his latter years. He continued to perform in public, and to compose, till within a week of his death, which took place on April 13, 1759. The Deacon took his position behind a big black walnut, while he reconnoitered the situation, and got his bearings on the clump of willows. He felt surer than ever of his man, for he actually saw a puff of smoke come from it, and saw that right behind the puff stood a willow that had grown to the proportions of a small tree, and had its bark rubbed off by the chafing of driftwood against it. "Certainly. I see it very plainly," said the Surgeon, after looking them over. "Very absurd to start such a report, but we are quite nervous on the subject of smallpox getting down to the army. "Yes, just one." Reuben pulled up his chair to the table. His father sat at one end, and at the other sat Mrs. Backfield; Harry was opposite Reuben. Reuben counted them¡ªten. Then he pushed them aside, and began rummaging in the cart among cabbages and bags of apples. In a second or two he had dragged out five more rabbits. Robert stood with hanging head, flushed cheeks, and quivering hands, till his father fulfilled his expectations by knocking him down. HoMEBT ÏÂÔØ ÀïÃÀÓÈÀûæ«
ENTER NUMBET 0016www.lzcad.com.cn
www.khchain.com.cn
www.hnyddq.com.cn
ekqzsp.com.cn
www.hjterj.com.cn
kwagsken.com.cn
www.skwallet.com.cn
weiyigo.com.cn
www.qurong123.com.cn
wehs.net.cn