首先,这个问题的背景是:Cannot install psycopg2 on OSX 10.6.7 with XCode4
所以我试图执行以下操作:
$PATH=$PATH:/Library/PostgreSQL/9.1/bin sudo env ARCHFLAGS="-arch i386 -arch x86_64" pip install psycopg2
然而,我得到以下内容:
/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/texbin:/usr/X11/bin=/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/texbin:/usr/X11/bin:/Library/PostgreSQL/9.1/bin: No such file or directory
基本上,我需要将'/Library/PostgreSQL/9.1/bin'添加到$ PATH,以便命令的其余部分可以执行,因为它需要来自该目录的内容。
有什么建议吗?
答案 0 :(得分:1)
分配的变量不应该有$
。
PATH=...
答案 1 :(得分:1)
尝试:
export PATH=$PATH:/Library/PostgreSQL/9.1/bin sudo env ARCHFLAGS="-arch i386 -arch x86_64" pip install psycopg2
答案 2 :(得分:1)
发出以下命令:
export PATH=$PATH:/Library/PostgreSQL/9.1/bin sudo env ARCHFLAGS="-arch i386 -arch x86_64" pip install psycopg2
答案 3 :(得分:0)
是的,如上所述删除$。您可能还需要-do选项来sudo,或者更改sudoers中的env_reset设置。您还可以在sudo之后指定环境变量。
sudo -E PATH="..." ARCH="..." pip install whatever