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

htaccess general rewrite but skip images

.htaccess

I am trying to include certain file extensions from being rewritten fi they dont exit.

Navigation Controller and View not updating when navigating back

iphone objective-c xcode ios

I have a navigation based app with a right bar button from my first view which pushes a second view to the navigation controller. Upon clicking the back button (left bar button) while viewing the s...

A question about datasource objects in ASP.net

c# asp.net gridview datasource

When using DataSources in ASP.net applications, paging and sorting along with GridView only works out of the box when using DataSet, DataTable, DataViews if you are using anything else you need to

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.