1、why should I make a copy of a data frame in pandas
2、Python 标准输出 sys.stdout 重定向
Psycopg2 install with pip works but cannot import module on OS X 10.9

OS X comes with Python 2.7.5 already; when you install Python with Homebrew, it puts a newer version in a different place without touching the built-in one. Homebrew's Python also comes with Pip, whereas OS X's doesn't. What's going on here is, you're using Homebrew's pip to install psycopg2, then running OS X's python and trying to import it.

Run /usr/local/bin/python (the full path to Homebrew's Python), and try import psycopg2 from there.

If that works, you need to put /usr/local/bin before /usr/bin in your PATH variable, so that your shell finds Homebrew's Python before the OS X one every time. If you use Bash (the default shell in OS X), you can do this by putting the following in your .bash_profile: