osx - Getting PyGame to import in Python interpreter after MacPorts install -


i'm trying start using pygame module can't run. i'm using mountain lion python 2.7 , macports, installed science , math modules using anaconda before ever discovered , started using macports. note macports updated before started of following. tried use:

sudo port install py27-game 

which looked worked , set without problem. but, when go python interpreter command line , type:

import pygame 

i response:

traceback (most recent call last):     file "<stdin>", line 1, in <module> importerror: no module named pygame 

so went in , did:

import sys print sys.path 

which gave:

 ['', '/users/trav/anaconda/lib/python27.zip', '/users/trav/anaconda/lib/python2.7',  '/users/trav/anaconda/lib/python2.7/plat-darwin',     '/users/trav/anaconda/lib/python2.7/plat-mac',    '/users/trav/anaconda/lib/python2.7/plat-mac/lib-scriptpackages',   '/users/trav/anaconda/lib/python2.7/lib-tk', '/users/trav/anaconda/lib/python2.7/lib-    old', '/users/trav/anaconda/lib/python2.7/lib-dynload',    '/users/trav/anaconda/lib/python2.7/site-packages',   '/users/trav/anaconda/lib/python2.7/site-packages/pil',   '/users/trav/anaconda/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info'] 

so, i'm guessing because used anaconda set when put numpy, scipy & matplotlib setup on here has caused macports clash somehow in path.

should remove ananconda package? if so, how can go removing these dependancies when that?

ok, figured out problem, , path. went in , removed anaconda package with:

rm -r ~/anaconda 

then, used macports reinstall whole scipy stack with:

sudo port install py27-wxpython py27-numpy py27-matplotlib py27-scipy py27-ipython 

this took time compile, , when finished went in on command line , used:

sudo port select --set python python27 

after opened interpreter , imported scientific computing needs without problem , pygame, had installed earlier macports. hope helps else in future. also: when remove packages anaconda, make sure , close terminal , re-open or still try use dependancies of anaconda, no longer there. had macports set after removing anaconda macports path became default.

one last edit. in order of run correctly , allow me run scripts within emacs imported modules had switch aquamacs normal emacs editor in order correct path used within emacs environment , or have run emacs terminal /application/emacs.app/contents/macos/emacs.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -