33👍
For OSX 10.9.2 Mavericks, this is what worked for me. Try installing postgres with brew first:
brew install postgresql
Then install pg
gem install pg
15👍
So I ended up following the advice here:
http://blog.jonypawks.net/2008/06/20/installing-psycopg2-on-os-x/
Turns out I did have pg-config
installed, but I had to dig around to find it a bit. Once I included that in the path, everything worked swimmingly. Here’s the snippet from that link:
PATH=$PATH:/Library/PostgresPlus/8.3/bin/ sudo easy_install psycopg2
I used pip
instead of easy_install
and my PostgreSQL installation directory was slightly different, but that’s the gist.
- [Django]-Django get a QuerySet from array of id's in specific order
- [Django]-Django model – set default charfield in lowercase
- [Django]-Auto-create primary key used when not defining a primary key type warning in Django
4👍
Just install postgres from source. I’m doing that on Mac OS X. It’s as easy as:
./configure
make
sudo make install
Of course you may need extra steps like autostarting, or setting configure options, but I belive this is still most painless way of setting up on Mac OS X.
And if you for some reason want to avoid installing from source, you should look for a binary version of psycopg2, e.g. here: http://www.initd.org/psycopg/download/
sudo port install py27-psycopg2
- [Django]-How to check if the object has property in view in Django?
- [Django]-Writing test cases for django models
- [Django]-Django: Switching to Jinja2?
2👍
In postgress.app on mavericks the file pg_config
is in /Applications/Postgres.app/Contents/MacOS/bin/
so i fixed the problem in this way:
sudo PATH=$PATH:/Applications/Postgres.app/Contents/MacOS/bin/ pip install psycopg2
- [Django]-Error: "dictionary update sequence element #0 has length 1; 2 is required" on Django 1.4
- [Django]-Django optional URL parameters
- [Django]-How can django sql queries use case insensitive and contains at the same time?
0👍
Using macports, this worked for me:
sudo port install postgresql96
sudo port select --set postgresql postgresql96
I believe this installs all the postgres client tools and libs, while macports has a separate port for installing the server, i.e. postgresql96-server
.
- [Django]-How to get the current language in Django?
- [Django]-{% %} and {{ }} in Django
- [Django]-Get list item dynamically in django templates
0👍
If you’re just trying to install psycopg2
to run on a mac for Django or Flask etc. then use:
pip install psycopg2-binary
From the docs https://www.psycopg.org/docs/install.html
- [Django]-Django urls without a trailing slash do not redirect
- [Django]-How to configure X-Frame-Options in Django to allow iframe embedding of one view?
- [Django]-Exclude a field from django rest framework serializer