Setting up Python and Virtualenv on OS X 10.8.1?

I recently reinstalled my OS X and my python setup is gone with it. I can't remember how I set it up before and now I am having a lot of trouble. I followed this guide (http://www.thisisthegreenroom.com/2011/installing-python-numpy-scipy-matplotlib-and-ipython-on-lion/#python) up to the part that makes a sym link. (CTRL+F this in the webpage: "ln -s /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/Current")

It didn't produce "/usr/local/bin/python" when I put in "which python". Instead, it gave me "/usr/bin/python".

What am I doing wrong? This is so frustrating! How can I fix this, or is there a better step by step tutorial that allows me to install python via Homebrew and then install virtualenv on top of that python installation?

Answers


FINALLY SOLVED IT!

the PATH variable has a short circuit logic to it. It goes down each variable(folder locations like "/etc/paths", "~/.profile", etc). When it finds your command ("python") in the folder it is looking at, that's what the terminal gives you.

To solve my problem, you have to put "/usr/local/bin"(where the homebrew python installation is) ahead of "/usr/bin"(where the default OS X python installation is.). To do this, open "/etc/paths" in terminal with:

open /etc/paths

this will open up the "paths" file in your default text editor. Now it should look something like this:

/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin

Since the file is in a protected folder, its not going to let you edit it directly. When you edit the file, it will ask to make a duplicate.

Save the duplicate to desktop, and move "/usr/local/bin" to the top, like this:

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

Remove the actual file("/etc/paths") and copy your duplicate file from the desktop. Be sure to remove the .txt extension on the duplicate. If you are not sure how to do this, go to Finder > Preferences > Advanced and check Show all filename extensions. Rename the file to "paths"

Log out and log back in to refresh it and you are done!


Need Your Help

Why does this print out twice?

java swing paintcomponent graphics2d

I've noticed that when i use paintComponent in java if I use System.out.println(); things will print out 2, 3, and sometimes 4 times. I know that when you use extends JPanel it will automatically be

Html - embed image directly in html (old school style)

html image embed

I know you can embed images in html today with:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.