Mercurial > hg > Blog
diff content/Python/installing-packages-in-userspace-on-osx.md @ 81:cdb041787591
add a python posting
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Thu, 27 Oct 2016 08:53:30 +0200 |
parents | |
children | 1d9382b0329b |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/content/Python/installing-packages-in-userspace-on-osx.md Thu Oct 27 08:53:30 2016 +0200 @@ -0,0 +1,23 @@ +Title: Installing pip packages in userspace on OSX +Date: 2016-10-27 +Lang: en + +I tried to install a python package with `pip` on my wife's Macbook Air. There are tons of instructions out on the internet telling you how to install pip and friends on OSX. All of them start by stating that the default install of Python that comes with OSX is somewhat weird and that you should really, really install a custom version of Python if you're intending to do serious Python development. + +Now I don't have the developer tools installed and I didn't intend to do so - wastes gigabytes of disk space that will hardly ever be used after all. So I tried to get away with the Python that's installed out of the box. + +Before I can use `pip` it has to be installed. I want to install everything in userspace so first a proper PYTHONPATH has to be set up: + + export PYTHONPATH=/Users/dirk/Python/site-packages + +Then I can go ahead and use `easy_install` to install `pip`: + + easy_install --install-dir /Users/dirk/Python/site-packages pip + +Make sure to add `/Users/dirk/Python` to your PATH so that you can call pip without specifying the full path. + +Now I can start installing packages: + + pip install --target /Users/dirk/Python/site-packages <package> + +This approach has its limitations, though. Since the developer tools aren't installed packages that require compliation of C code won't work. \ No newline at end of file