How to get correct file permissions from Macports pip installs?
You can use virtualenv to create a local "copy" of the Python installation that's owned and easily manipulated by you. The advantage to using virtualenv is you can make many copies of the same version of Python, but with different versions of similar packages installed, and then switch between them with the virtualenv command line.
This lets you use different versions of libraries in different projects or incompatible libraries.
To install virtualenv:
sudo pip install virtualenv
And now you can use it yourself, without sudo, to create a virtual python owned by you:
mkdir -p ~/Development/mypythonproject
cd ~/Development/mypythonproject
virtualenv .venv
source .venv/bin/activate
For example:
IanCsiMac:~/Development/keybase-python |ruby-2.1.2| [git::develop]
> which python
/usr/local/bin/python
IanCsiMac:~/Development/keybase-python |ruby-2.1.2| [git::develop]
> source .venv/bin/activate
(.venv)
IanCsiMac:~/Development/keybase-python |ruby-2.1.2| [git::develop]
> which python
/Users/ian/code/keybase-python/.venv/bin/python
(.venv)
IanCsiMac:~/Development/keybase-python |ruby-2.1.2| [git::develop]
> deactivate
IanCsiMac:~/Development/keybase-python |ruby-2.1.2| [git::develop]
> which python
/usr/local/bin/python
You can virtualenv-install in your ~
directory if you want a default python that you control to be available at all times like so:
cd ~
virtualenv venv
And now you've got ~/venv/bin/pip
available to you. You can modify your ~/.bash_profile
and add:
source venv/bin/activate
Right at the end of it to have your virtualenv available by default in your shell.