我试图通过pip在OS X上安装pycrypto(版本2.3).当编译器尝试编译MD2.c时,我收到"Broken pipe"错误.使用easy_install时出现非常类似的错误.
这是我得到的错误:
bash-3.2$
bash-3.2$ sudo pip install pycrypto
Password:
Downloading/unpacking pycrypto
Running setup.py egg_info for package pycrypto
Installing collected packages: pycrypto
Running setup.py install for pycrypto
warning: GMP library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash.MD2' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -fwrapv -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/MD2.c -o build/temp.macosx-10.6-universal-2.6/src/MD2.o
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64 …Run Code Online (Sandbox Code Playgroud) 使用SQLAlchemy时,将对象插入到具有外键列的表中然后提交它的理想方法是什么?在下面的代码中插入带外来物的对象有什么问题吗?
def retrieve_objects():
session = DBSession()
return session.query(SomeClass).all()
def insert_objects():
session = DBSession()
for obj in retrieve_objects():
another_obj = AnotherClass(somefield=0)
obj.someforeignkey = another_obj
session.add(obj)
session.flush()
transaction.commit()
session.close()
return None
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建python包pycrypto.OS X安装了gcc-4.2而不是gcc-4.0,但是python继续尝试使用gcc-4.0.如何才能使用gcc-4.2?或者我应该采取不同的方式.
我收到以下错误:
bash-3.2$
bash-3.2$ sudo python setup.py build
running build
running build_py
running build_ext
warning: GMP library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash.MD2' extension
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/MD2.c -o build/temp.macosx-10.3-fat-2.6/src/MD2.o
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
bash-3.2$
bash-3.2$
bash-3.2$
Run Code Online (Sandbox Code Playgroud)
我正在使用带有python 2.6.6的Mac OS X 10.6.7并安装了XCode.
编辑:如果我添加CC = gcc-4.2,那么我仍然得到错误:
bash-3.2$
bash-3.2$ export CC=gcc-4.2
bash-3.2$ python setup.py build
running …Run Code Online (Sandbox Code Playgroud)