5

私は必死にpsycopg2を正常にインストールしようとしていますが、エラーが発生し続けています。最新のものには、「stdarg.h」が見つからないことが含まれているようです(以下のコードを参照)。ただし、stdarg.h というファイルが /Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h (何も見つからないと主張している場所) に存在することを自分の目で確認できるので、それについて何をすべきかわからない。

Mac OS 10.6.3 を実行していますが、ここ数日のうちに、最新の OS 開発者ツールがすべて揃っていることを確認しました。

それが違いを生むなら、私はPython 2.6.2とPostgreSQL 8.4を持っています。

python setup.py install    
running install
running build
running build_py
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.macosx-10.3-fat-2.6
creating build/temp.macosx-10.3-fat-2.6/psycopg
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.2.1 (dt dec ext pq3)" -DPG_VERSION_HEX=0x080404 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DHAVE_PQPROTOCOL3=1 -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -I. -I/opt/local/include/postgresql84 -I/opt/local/include/postgresql84/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.3-fat-2.6/psycopg/psycopgmodule.o
In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
             from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
             from psycopg/psycopgmodule.c:27:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
             from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
             from psycopg/psycopgmodule.c:27:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/MQ/MQ-tWOWWG+izzuZCrAJpzk+++TI/-Tmp-//ccakFhRS.out
error: command 'gcc' failed with exit status 
4

3 に答える 3

3

具体的な問題はわかりませんが、macportsを使用してインストールすることをお勧めします。psycopg2
の インストールは次のように簡単です。

sudo port install py26-psycopg2
于 2010-06-15T12:01:35.563 に答える
3

以下は私にとってはうまくいきます:

  1. $ mkvirtualenv --no-site-packages --distribute psycopg2_test
  2. $ cd $VIRTUAL_ENV
  3. $ pip install psycopg2

ノート

  • ベースの Python をMacPorts経由でインストールしました。
  • 上記のコマンドは以下を利用します。

  • 次の方法でブートストラップpipしました。

    1. wget http://python-distribute.org/distribute_setup.py
    2. python distribute_setup.py
    3. easy_install pip

更新: ヤクの毛を剃るのが大変なように思えますが、使用方法や友人を学ぶことvirtualenvは、特に多くの依存関係を持つプロジェクトを扱う場合に、すぐに報われる先行投資です。

于 2010-06-15T12:03:28.163 に答える
1

私は実際にこれと非常によく似た問題を抱えていました(OSX Lion、Python 2.7を除く)virtualenvにpsycopg2をインストールできません "エラー:stdarg.h:そのようなファイルまたはディレクトリはありません"

私はこのソリューションを使用することになりました:https ://stackoverflow.com/a/8834568/396327

基本的に、XCodeを最初からアンインストール/再インストールします(そして、gcc-4.2を認識させるためのいくつかのハック)。

于 2012-04-27T03:14:39.243 に答える