简体   繁体   English

在virtualenv的os x lion上安装mysql-python时出现编译器错误

[英]compiler error when installing mysql-python on os x lion in a virtualenv

I've found 101 threads on this but no solutions for my actual problem. 我已经找到101个线程,但是没有解决我的实际问题。

Here's the situation. 这是情况。 virtualenv, installed yolk, checked out my code into that env, the code includes django so don't have to install it into the env. virtualenv,已安装的蛋黄,将我的代码签入到该env中,该代码包含django,因此不必将其安装到env中。

I've added the project location into the activate script. 我已经将项目位置添加到了激活脚本中。

The next step is to install mysql-python but that will fail. 下一步是安装mysql-python,但这将失败。 However the source is downloaded so I can edit setup_posix.py put the mysql_config location in and then retry. 但是,源已下载,因此我可以编辑setup_posix.py,将mysql_config位置放入,然后重试。

So the command is 所以命令是

pip install mysql-python -E focus02

with focus02 being the env name. 其中focus02为环境名称。

The error message is this 错误信息是这个

lipo: can't open input file: /var/folders/38/bjgqwdxn37lb1ytw3qtmrwxc0000gp/T//ccTgPn2I.out (No such file or directory)

error: command 'llvm-gcc-4.2' failed with exit status 1

most of the stuff I've found online focuses on the last line of that, stating the compiler doesn't exist. 我在网上找到的大多数内容都集中在最后一行,说明编译器不存在。 I can prove this isn't the case by running llvm-gcc-4.2 in terminal. 我可以通过在终端中运行llvm-gcc-4.2来证明情况并非如此。 I get a response of 我得到了回应

i686-apple-darwin11-llvm-gcc-4.2: no input files

I think the error is in the line above. 我认为错误在上面的行中。 Note the double slash before the file name. 注意文件名之前的双斜杠。 I can't find an article on google that shows that someone has found a fix. 我在Google上找不到一篇文章,表明有人找到了修复程序。 Anyone know where that line is drawing its input from, as I'm not sure where the issue is coming from. 任何人都知道那条线是从哪里提取输入的,因为我不确定问题是从哪里来的。 I'm assuming I've edited a file and left a trailing slash that I didn't need, though there's a few instances of this error that leads me to believe maybe not. 我假设我已经编辑了一个文件,并留下了我不需要的斜杠,尽管有一些错误的实例使我相信也许不是。

I've found this article and it's not fixed the problem. 我找到了这篇文章 ,但并没有解决问题。

just in case google brings anyone to this page in search of an answer i managed to solve this one this morning. 以防万一google将任何人带到此页面以寻找我今天早上设法解决的答案。

the fix is to link the right mysq_config in when trying to install mysql-python 解决方法是在尝试安装mysql-python时链接正确的mysq_config

so line 24 of setup_posix.py is the line that fails the install process as you intall python-mysql the first time. 因此,setup_posix.py的第24行是在您首次安装python-mysql时使安装过程失败的行。 you need to fixup the line then rerun the pip install command. 您需要修正该行,然后重新运行pip install命令。

line 24 is the link to mysql_config. 第24行是mysql_config的链接。 when you're running MAMP the binaries for mysql_config won't work for this, so make sure you've downloaded the mysql source elsewhere, stored it on your path or added the folder to your path and then link it in correctly inside the setup_posix.py file before installing mysql-python. 当您运行MAMP时,mysql_config的二进制文件将无法正常运行,因此请确保已将mysql源下载到其他位置,将其存储在路径中或将文件夹添加到路径中,然后将其正确链接到setup_posix内部安装mysql-python之前的.py文件。

hope this helps someone. 希望这对某人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM