2012-07-24 82 views
14

我想用Python 2.7.3在Ubuntu 10.04(Lucid Lynx)上安装pycrypto2.6。Ubuntu上的pycrypto给编译器错误

我遇到了以下错误:

running build 
running build_py 
running build_ext 
running build_configure 
checking for gcc... no 
checking for cc... no 
checking for cl.exe... no 
configure: error: in `/home/pratibha/Desktop/pycrypto-2.6': 
configure: error: no acceptable C compiler found in $PATH 
See `config.log' for more details 
Traceback (most recent call last): 
File "setup.py", line 456, in <module> 
core.setup(**kw) 
File "/usr/local/lib/python2.7/distutils/core.py", line 152, in setup 
dist.run_commands() 
File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands 
self.run_command(cmd) 
File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command 
cmd_obj.run() 
File "/usr/local/lib/python2.7/distutils/command/build.py", line 127, in run 
self.run_command(cmd_name) 
File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command 
self.distribution.run_command(command) 
File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command 
cmd_obj.run() 
File "setup.py", line 251, in run 
self.run_command(cmd_name) 
File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command 
self.distribution.run_command(command) 
File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command 
cmd_obj.run() 
File "setup.py", line 278, in run 
raise RuntimeError("autoconf error") 
RuntimeError: autoconf error 

我检查软件中心,我有我的系统上安装GCC,但“它的gcc”命令没有返回任何路径。

我把它通过创建符号链接:

ln -s /usr/bin/gcc-4.4 /usr/bin/gcc 
+2

你好pratibha,请不要在你的问题标题中加上[[solve]],这不是这个网站的工作原理。将答案发布为答案(您可以在短时间内完成答案)。如果您在发布时已经知道答案,那么在问题编辑器中有一个按钮。 – Mat 2012-07-24 06:45:01

+0

您不应该自己创建该符号链接。安装'gcc'包(我记得它是预先安装的)应该已经为你创建了符号链接。 – 2016-05-14 02:51:28

+0

我通过了gcc部分,但是'检查我们是否正在交叉编译'我得到了'configure:error:无法运行C编译的程序。如果你想交叉编译,使用'--host'。有关更多详细信息,请参阅'config.log'从未找到config.log。无论如何,[TMPDIR答案](https://stackoverflow.com/a/29298978/673991)工作。耶安全由默默无闻。 – 2017-11-06 22:38:46

回答

13

我有一个类似的问题,但在我的情况下,事实证明我没有gcc安装在所有。

所以一个简单的sudo apt-get install gcc做了伎俩。

如果已安装它,但which gcc不返回任何路径,请转至/usr/bin/并查找gcc。然后创建符号链接,就像这样:

ln -s /usr/bin/gcc-<version-number> /usr/bin/gcc 

,你有相应的版本号代替<version-number>,当然。

+0

'$ which gcc' '/ usr/bin/gcc' 仍然无法正常工作。 – zgoda 2015-12-29 08:45:58

+0

>所以一个简单的sudo apt-get install gcc就完成了这个任务。 这工作对我来说 – jward01 2017-09-10 17:09:24

5

我遇到了同样的问题,尝试安装gcc的上述步骤并没有帮助。

一旦我安装了python-dev软件包,一切都编译完美。

sudo apt-get install python-dev

+0

这工作在debian上。谢谢 – asselinpaul 2014-04-14 22:23:54

+0

这对我有用,确保已安装gcc和python-dev – JVercout 2016-04-14 12:13:40

17

我的共享主机(Webfaction)上安装pycrypto时遇到类似的错误消息。解决方案是在安装时更改临时目录:

TMPDIR=~/tmp pip install pycrypto 
+2

谢谢,这个答案帮了我一个盒子我试图用pip来安装paramiko,它的noexec为/ tmp – joshbaptiste 2015-08-03 19:37:12

+2

不幸的是,这并没有帮助,仍然得到了上述错误。 – zgoda 2015-12-29 08:47:27

+0

这是原始问题的错误解决方案。有助于另一种情况。 – loop 2016-03-10 03:07:40