私はvirtualenv内でOSX 10.12.2(16C67)と3.6.0を実行しています。Python3.6でvirtualenvを使ってmacにpsycopg2をインストールするには?
私は次のようにテストしました。
➜ ~ brew services restart postgresql
Stopping `postgresql`... (might take a while)
==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql)
==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)
➜ ~ pg_config
BINDIR = /usr/local/Cellar/postgresql/9.6.1/bin
DOCDIR = /usr/local/Cellar/postgresql/9.6.1/share/doc/postgresql
HTMLDIR = /usr/local/Cellar/postgresql/9.6.1/share/doc/postgresql
INCLUDEDIR = /usr/local/Cellar/postgresql/9.6.1/include
PKGINCLUDEDIR = /usr/local/Cellar/postgresql/9.6.1/include
INCLUDEDIR-SERVER = /usr/local/Cellar/postgresql/9.6.1/include/server
LIBDIR = /usr/local/lib
PKGLIBDIR = /usr/local/lib/postgresql
LOCALEDIR = /usr/local/Cellar/postgresql/9.6.1/share/locale
MANDIR = /usr/local/Cellar/postgresql/9.6.1/share/man
SHAREDIR = /usr/local/share/postgresql
SYSCONFDIR = /usr/local/etc/postgresql
PGXS = /usr/local/lib/postgresql/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--disable-debug' '--prefix=/usr/local/Cellar/postgresql/9.6.1' '--datadir=/usr/local/share/postgresql' '--libdir=/usr/local/lib' '--sysconfdir=/usr/local/etc' '--docdir=/usr/local/Cellar/postgresql/9.6.1/share/doc/postgresql' '--enable-thread-safety' '--with-bonjour' '--with-gssapi' '--with-ldap' '--with-openssl' '--with-pam' '--with-libxml' '--with-libxslt' '--with-perl' '--with-tcl' '--with-tclconfig=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib' '--with-uuid=e2fs' 'CC=clang' 'LDFLAGS=-L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib' 'CPPFLAGS=-I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include'
CC = clang
CPPFLAGS = -DFRONTEND -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -O2
CFLAGS_SL =
LDFLAGS = -L../../src/common -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -Wl,-dead_strip_dylibs
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lm
VERSION = PostgreSQL 9.6.1
➜ ~ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
XCodeツールがインストールされていることを確認しました。しかし、psycopg2をインストールしようとするとエラーが発生します。どのようなアイデアを次にするか。
** EDIT
私はちょうど同じPythonのバージョンを使用してvirtualenvの外にそれをインストールしようとしましたが、それは何の問題もなくインストールされています。
➜ ~ pip3 install psycopg2
Collecting psycopg2
Using cached psycopg2-2.6.2.tar.gz
Building wheels for collected packages: psycopg2
Running setup.py bdist_wheel for psycopg2 ... done
Stored in directory: /Users/Kimmo/Library/Caches/pip/wheels/49/47/2a/5c3f874990ce267228c2dfe7a0589f3b0651aa590e329ad382
Successfully built psycopg2
Installing collected packages: psycopg2
Successfully installed psycopg2-2.
6.2
「パイプ」が実行されるのは混乱しているようです。これは良くありません。このような状況(あなたが '' python'が実行されることを知っていると仮定すれば:-))では、代わりに 'python -m pip'を使うほうが良いでしょう。 – holdenweb
-mフラグを使って他のPythonモジュールと同じようにpipを実行できませんでした。はい、良い考えかもしれません。 –
はい、引数は 'pip'と同じように処理され、どちらを使うかを簡単に判断できます。しかし、私は本当の問題は、python2とpython3が同じディレクトリにインストールされていると思われます。 – holdenweb