Python中文
首页
教程
问答
标签
搜索
登录
注册
在OS X上使用错误版本的GCC构建Python
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我正在尝试构建python包pycrypto。OS X安装了gcc-4.2,而不是gcc-4.0,但是python继续尝试使用gcc-4.0。如何使用gcc-4.2?或者我应该换一种方式。</p> <p>我得到以下错误:</p> <pre><code>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$ </code></pre> <p>我使用MacOSX10.6.7和Python2.6.6,并安装了XCode。</p> <p>编辑:如果添加CC=gcc-4.2,则仍然会得到错误:</p> <pre><code>bash-3.2$ bash-3.2$ export CC=gcc-4.2 bash-3.2$ 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.2 -fno-strict-aliasing -fno-common -dynamic -std=c99 -O3 -fomit-frame-pointer -arch i386 -arch x86_64 -Isrc/ -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/MD2.c -o build/temp.macosx-10.3-intel-2.6/src/MD2.o gcc-4.0 -g -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 build/temp.macosx-10.3-intel-2.6/src/MD2.o -o build/lib.macosx-10.3-intel-2.6/Crypto/Hash/MD2.so unable to execute gcc-4.0: No such file or directory error: command 'gcc-4.0' failed with exit status 1 bash-3.2$ </code></pre> <p>编辑:看来使用sudo在这里会有所不同。</p> <p>我尝试按照Adam的建议同时使用CC和CXX,在没有sudo的情况下得到以下错误:</p> <pre><code>bash-3.2$ python setup.py build running build running build_py creating build/lib.macosx-10.3-fat-2.6 creating build/lib.macosx-10.3-fat-2.6/Crypto copying lib/Crypto/__init__.py -> build/lib.macosx-10.3-fat-2.6/Crypto copying lib/Crypto/pct_warnings.py -> build/lib.macosx-10.3-fat-2.6/Crypto ... warning: GMP library not found; Not building Crypto.PublicKey._fastmath. building 'Crypto.Hash.MD2' extension creating build/temp.macosx-10.3-fat-2.6 creating build/temp.macosx-10.3-fat-2.6/src gcc-4.2 -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 /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 /usr/bin/../libexec/gcc/darwin/i386/as for architecture i386 lipo: can't open input file: /var/tmp//ccxan625.out (No such file or directory) error: command 'gcc-4.2' failed with exit status 1 </code></pre> <p>如果我使用sudo,当它尝试使用4.0时,会出现以下错误:</p> <pre><code>bash-3.2$ sudo python setup.py build Password: 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$ </code></pre> <p>这些额外的信息是否让事情变得更加明显,以及如何解决?你知道为什么没有sudo的呼叫会出现另一个错误吗?</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>顺便说一下,这是一个<code>distutils</code>问题,Python本身不编译任何东西。</p> <p>正如您所发现的,您可以使用<code>CC</code>环境变量重写编译器。可以重写与<code>CXX</code>环境变量一起使用的链接器。我也想知道为什么distutils会这样做,但事实也是如此。</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
我是否正确构建了这个递归神经网络
2 回答
我是否正确理解acquire和realease是如何在python库“线程化”中工作的
5 回答
我是否正确理解Keras中的批次大小?
2 回答
我是否正确理解PyTorch的加法和乘法?
4 回答
我是否正确组织了我的Django应用程序?
10 回答
我是否正确计算执行时间?如果是这样,那么并行处理将花费更长的时间。这看起来很奇怪
6 回答
我是否每次创建新项目时都必须在PyCharm中安装numpy?(安装而不是导入)
5 回答
我是否每次运行jupyter笔记本时都必须重新启动内核?
3 回答
我是否用python安装了socks模块?
9 回答
我是否真的需要知道超过一种语言,如果我想要制作网页应用程序?
5 回答
我是否缺少spaCy柠檬化中的预处理功能?
9 回答
我是否缺少给定状态下操作的检查?
7 回答
我是否能够使用函数“count()”来查找密码中大写字母的数量((Python)
9 回答
我是否能够使用用户输入作为colorama模块中的颜色?
4 回答
我是否能够创建一个能够添加新Django.contrib.auth公司没有登录到管理面板的用户?
9 回答
我是否能够将来自多个不同网站的数据合并到一个csv文件中?
2 回答
我是否能够将目录路径转换为可以输入python hdf5数据表的内容?
4 回答
我是否能够等到一个对象被销毁,直到它创建另一个对象,然后在循环中运行time.sleep()
1 回答
我是否能够通过CBV创建用户实例,而不是首先创建表单?(Django)
9 回答
我是否要使它成为递归函数?
8 回答