Python 带Psycopg2的OS X山狮(未找到符号:_-PyMemoryView_-Type)

Python 带Psycopg2的OS X山狮(未找到符号:_-PyMemoryView_-Type),python,django,psycopg2,osx-mountain-lion,Python,Django,Psycopg2,Osx Mountain Lion,在过去的几天里,我一直在解决这个问题,这使我无法正确设置本地环境。以下是我的设置: 使用OS X 10.8 Mountain Lion 通过自制,我安装了Python和PostgreSQL 在虚拟环境中,我通过PIP安装了Django和psycopg2.4.5 我已经验证了我可以通过pgAdmin3连接到我的PostgreSQL数据库 然而,每当我启动Apache服务器并导航到本地URL时,我都会遇到一个可怕的错误: dlopen({....}/lib/python2.7/site-pack

在过去的几天里,我一直在解决这个问题,这使我无法正确设置本地环境。以下是我的设置:

  • 使用OS X 10.8 Mountain Lion
  • 通过自制,我安装了Python和PostgreSQL
  • 在虚拟环境中,我通过PIP安装了Django和psycopg2.4.5
  • 我已经验证了我可以通过pgAdmin3连接到我的PostgreSQL数据库
然而,每当我启动Apache服务器并导航到本地URL时,我都会遇到一个可怕的错误:

dlopen({....}/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): 
Symbol not found: _PyMemoryView_Type

Referenced from: {....}/lib/python2.7/site-packages/psycopg2/_psycopg.so
Expected in: flat namespace in {....}/lib/python2.7/site-packages/psycopg2/_psycopg.so
以下是我安装psycopg2时的结果:

Downloading/unpacking psycopg2
  Downloading psycopg2-2.4.5.tar.gz (719Kb): 719Kb downloaded
  Running setup.py egg_info for package psycopg2

    no previously-included directories found matching 'doc/src/_build'
Installing collected packages: psycopg2
  Running setup.py install for psycopg2
    building 'psycopg2._psycopg' extension
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/psycopgmodule.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/green.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/green.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/pqpath.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/pqpath.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/utils.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/utils.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/bytes_format.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/bytes_format.o
    In file included from psycopg/bytes_format.c:81:
    In file included from ./psycopg/psycopg.h:33:
    ./psycopg/config.h:71:13: warning: unused function 'Dprintf' [-Wunused-function]
    static void Dprintf(const char *fmt, ...) {}
                ^
    1 warning generated.
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/connection_int.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/connection_int.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/connection_type.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/connection_type.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/cursor_int.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/cursor_int.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/cursor_type.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/cursor_type.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/lobject_int.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/lobject_int.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/lobject_type.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/lobject_type.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/notify_type.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/notify_type.o
    In file included from psycopg/notify_type.c:27:
    In file included from ./psycopg/psycopg.h:33:
    ./psycopg/config.h:71:13: warning: unused function 'Dprintf' [-Wunused-function]
    static void Dprintf(const char *fmt, ...) {}
                ^
    1 warning generated.
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/xid_type.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/xid_type.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/adapter_asis.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_asis.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/adapter_binary.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_binary.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/adapter_datetime.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_datetime.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/adapter_list.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_list.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/adapter_pboolean.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_pboolean.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/adapter_pdecimal.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_pdecimal.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/adapter_pint.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_pint.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/adapter_pfloat.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_pfloat.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/adapter_qstring.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_qstring.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/microprotocols.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/microprotocols.o
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/microprotocols_proto.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/microprotocols_proto.o
    In file included from psycopg/microprotocols_proto.c:27:
    In file included from ./psycopg/psycopg.h:33:
    ./psycopg/config.h:71:13: warning: unused function 'Dprintf' [-Wunused-function]
    static void Dprintf(const char *fmt, ...) {}
                ^
    1 warning generated.
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -Os -pipe -march=native -mmacosx-version-min=10.8 -Wno-unused-value -Wno-empty-body -Qunused-arguments -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090104 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.1.4/include -I/usr/local/Cellar/postgresql/9.1.4/include/server -c psycopg/typecast.c -o build/temp.macosx-10.8-x86_64-2.7/psycopg/typecast.o
    In file included from psycopg/typecast.c:179:
    ./psycopg/typecast_array.c:227:31: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                if (--stack_index < 0)
                    ~~~~~~~~~~~~~ ^ ~
    1 warning generated.
    /usr/bin/clang -bundle -undefined dynamic_lookup -L/usr/local/Cellar/readline/6.2.4/lib -L/usr/local/Cellar/gettext/0.18.1.1/lib -L/usr/local/lib -L/opt/X11/lib -arch x86_64 build/temp.macosx-10.8-x86_64-2.7/psycopg/psycopgmodule.o build/temp.macosx-10.8-x86_64-2.7/psycopg/green.o build/temp.macosx-10.8-x86_64-2.7/psycopg/pqpath.o build/temp.macosx-10.8-x86_64-2.7/psycopg/utils.o build/temp.macosx-10.8-x86_64-2.7/psycopg/bytes_format.o build/temp.macosx-10.8-x86_64-2.7/psycopg/connection_int.o build/temp.macosx-10.8-x86_64-2.7/psycopg/connection_type.o build/temp.macosx-10.8-x86_64-2.7/psycopg/cursor_int.o build/temp.macosx-10.8-x86_64-2.7/psycopg/cursor_type.o build/temp.macosx-10.8-x86_64-2.7/psycopg/lobject_int.o build/temp.macosx-10.8-x86_64-2.7/psycopg/lobject_type.o build/temp.macosx-10.8-x86_64-2.7/psycopg/notify_type.o build/temp.macosx-10.8-x86_64-2.7/psycopg/xid_type.o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_asis.o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_binary.o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_datetime.o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_list.o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_pboolean.o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_pdecimal.o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_pint.o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_pfloat.o build/temp.macosx-10.8-x86_64-2.7/psycopg/adapter_qstring.o build/temp.macosx-10.8-x86_64-2.7/psycopg/microprotocols.o build/temp.macosx-10.8-x86_64-2.7/psycopg/microprotocols_proto.o build/temp.macosx-10.8-x86_64-2.7/psycopg/typecast.o -L/usr/local/Cellar/postgresql/9.1.4/lib -lpq -lssl -lcrypto -o build/lib.macosx-10.8-x86_64-2.7/psycopg2/_psycopg.so

    no previously-included directories found matching 'doc/src/_build'
Successfully installed psycopg2

在MacOSX上编译python包时,通常会看到一些c警告,因为它使用的是clang而不是gcc。它们不应该成为问题所在。该问题看起来像您的WSGI HTTPD设置

使用WSGI和虚拟环境以及WSGI,您需要确保正确设置流程环境


看起来您需要修改HTTPD指令以包含处理环境。请参阅WSGI中的虚拟环境,标题为。

在与文件和设置共舞了一天之后,我终于找到了答案。很大程度上要感谢@BigShumany为我指引了正确的方向。在我的apachehttpd.conf文件中,我使用了OS X 10.8附带的mod_wsgi.so。显然这就是问题所在。我通过执行以下操作修复了它:

  • 使用自制软件安装新版mod_wsgi.so(
    brew安装mod_wsgi
  • 起初,自制软件给了我一个与山狮和mod_wsgi相关的错误。我遵循了有关此报告问题的符号链接说明:
  • 在对链接中详细介绍的文件进行符号链接后,我重新编辑了brew install mod_wsgi,并成功运行
  • 我将httpd.conf更新为:
    LoadModule wsgi_module/usr/local/ceral/mod_wsgi/3.3/libexec/mod_wsgi.so
  • 我重新启动了Apache2(
    apachectl restart
    ),瞧
    这也困扰着我。确保已经为python的正确版本构建了mod_wsgi

    事实证明,我已经为python2.6构建了mod_wsgi,但我运行该网站的VirtualNV正在使用python2.7。我正在使用macports,因此以下功能对我有效:

    sudo port uninstall mod_wsgi
    sudo port install mod_wsgi +python2.7
    
    然后重新启动apache

    带MacPorts的OS X 10.7.3

    当Apache开始查看您使用的Python版本时,请查看error.log中的以下行:

    [notice] Apache/2.2.24 (Unix) mod_ssl/2.2.24 OpenSSL/1.0.1e DAV/2 mod_wsgi/3.3 Python/2.7.5 configured -- resuming normal operations
    

    非常感谢您的回复。看起来我已经有了推荐的方法之一,可以通过pythonpath=添加我的流程环境。我在我的原始帖子中又添加了两个文件以获取更多信息。根据提供的其他信息,还有其他想法吗?谢谢嗯,我可以做一些事情,让我测试一下你的设置。
    sudo port uninstall mod_wsgi
    sudo port install mod_wsgi +python2.7
    
    [notice] Apache/2.2.24 (Unix) mod_ssl/2.2.24 OpenSSL/1.0.1e DAV/2 mod_wsgi/3.3 Python/2.7.5 configured -- resuming normal operations