OS X Mountain Lion与Psycopg2(未找到符号:_PyMemoryView_Type)

时间:2012-08-18 11:01:27

标签: python django psycopg2 osx-mountain-lion

过去几天我一直坚持这个问题,这使我无法正确设置本地环境。这是我的设置:

  • 使用OS X 10.8 Mountain Lion
  • 通过自制程序我安装了Python和PostgreSQL。
  • 在Virtualenv中,我通过PIP安装了带有psycopg2 2.4.5的Django
  • 我已经确认我可以通过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

关于可能导致这种情况的任何想法?我很难过,我迫切需要一些帮助。提前致谢。如果有更多信息有用,请告诉我。


这是Apache的vhost文件:

NameVirtualHost *:80

<VirtualHost mysite.local:80>
    ServerName mysite.local

    Alias /assets/ {...}/app/webapp/assets/
    Alias /static/ {...}/lib/python2.7/site-packages/django/contrib/admin/static/
    Alias /robots.txt {...}/app/webapp/assets/robots.txt
    Alias /favicon.ico {...}/app/webapp/assets/favicon.ico

    CustomLog "{...}/logs/apache-access.log" combined
    ErrorLog "{...}/logs/apache-error.log"
    LogLevel warn

    WSGIDaemonProcess mysite.local processes=1 threads=1 maximum-requests=1 python-path={...}/lib/python2.7/site-packages python-eggs={...}/lib/python2.7/site-packages
    WSGIProcessGroup mysite.local
    WSGIScriptAlias / {...}/conf/apache/django.wsgi
    WSGIPassAuthorization On

    <Directory {...}/app/webapp/assets>
    Order deny,allow
    Allow from all
    Options -Indexes FollowSymLinks
    </Directory>

    <Directory {...}/conf/apache>
    Order deny,allow
    Allow from all
    </Directory>
</VirtualHost>

这是我的django.wsgi文件:

import os, sys
import django.core.handlers.wsgi
import site

sys.path.append('{...}/lib/python2.7/site-packages')
sys.path.append('{...}/app')
sys.path.append('{...}/app/webapp')
sys.path.append('{...}/app/webapp/apps')

os.environ['DJANGO_SETTINGS_MODULE'] = 'webapp.settings.production'

site.addsitedir('{...}/lib/python2.7/site-packages')

application = django.core.handlers.wsgi.WSGIHandler()

3 个答案:

答案 0 :(得分:0)

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

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

您似乎需要更改HTTPD指令以包含处理环境。请参阅WSGI中的虚拟环境,标题为Process Environments

的部分

答案 1 :(得分:0)

经过一天的文件和设置跳舞后,我终于明白了。非常感谢@BigHandsome带领我朝着正确的方向前进。在我的Apache httpd.conf文件中,我使用的是OS X 10.8附带的mod_wsgi.so。显然这就是问题所在。我通过执行以下操作来修复它:

  1. 使用Homebrew安装新版本的mod_wsgi.so(brew install mod_wsgi
  2. 起初,Homebrew向我提出了与Mountain Lion和mod_wsgi相关的错误。我按照这个报告问题的符号链接说明: https://github.com/mxcl/homebrew/issues/13919
  3. 在对链接中详述的文件进行符号链接后,我重新brew install mod_wsgi并且它有效。
  4. 我用LoadModule wsgi_module /usr/local/Cellar/mod_wsgi/3.3/libexec/mod_wsgi.so
  5. 更新了我的httpd.conf
  6. 我重新启动了Apache2(apachectl restart)并瞧!

答案 2 :(得分:0)

这也困扰着我。确保你已经为正确版本的python构建了mod_wsgi。

原来我为python2.6构建了mod_wsgi但运行该网站的virtualenv正在使用python2.7。我正在使用macports,所以以下内容对我有用:

sudo port uninstall mod_wsgi
sudo port install mod_wsgi +python2.7

然后重启apache。

OS X 10.7.3 w / MacPorts

当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