无法在Mac OS X 10.10上构建python gevent [英] Can't build python gevent on mac osx 10.10

查看:182
本文介绍了无法在Mac OS X 10.10上构建python gevent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简介: pip install gevent不起作用.

向下挖掘,我下载了gevent .tar.gz并手动运行了构建:python setup.py build,出现了相同的错误:

Digging down, I downloaded the gevent .tar.gz and ran the build manually: python setup.py build, got the same error:

running build
running build_py
running build_ext
building 'gevent.core' extension
clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -U__llvm__ -DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CLEANUP_ENABLE=0 -DEV_EMBED_ENABLE=0 -DEV_PERIODIC_ENABLE=0 -Ibuild/temp.macosx-10.10-x86_64-2.7/libev -Ilibev -I/Users/travisjohnson/.pyenv/versions/2.7.5/include/python2.7 -c gevent/gevent.core.c -o build/temp.macosx-10.10-x86_64-2.7/gevent/gevent.core.o
In file included from gevent/gevent.core.c:313:
In file included from gevent/libev.h:2:
...
29 various compiler warnings
...
29 warnings generated.
clang -bundle -bundle_loader python.exe -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/travisjohnson/.pyenv/versions/2.7.5/lib -U__llvm__ build/temp.macosx-10.10-x86_64-2.7/gevent/gevent.core.o -o build/lib.macosx-10.10-x86_64-2.7/gevent/core.so
ld: file not found: python.exe
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1

我的第一个念头是看起来好像在告诉clang将python.exe链接到某些东西",最初我以为是废话(这不是Windows),但是:https://docs.python.org/devguide/setup.html#unix 表示python.exe是构建后python的默认名称(由于大小写)不敏感),所以现在我不知道.

My first thought is "It looks like it's telling clang to link python.exe into something", which initially I thought was nonsense (this isn't windows), but: https://docs.python.org/devguide/setup.html#unix says python.exe is the default name for python after building (because of case insensitivity), so now I don't know.

我已经研究了几个小时,没有下一步. 我在另一个项目中发现了类似的东西(我认为),但没有说明原因或解决问题的方法,只是解决了问题(我检查过我的xcode和开发人员工具等是否最新)

I've been digging at this for hours, and don't have a next step. I found something similar (I think) on a different project, but there was no explanation on the cause or what fixed it, just that it was fixed (I've checked that my xcode and developer tools etc are up to date)

接下来的步骤让我无所适从,有人可以指出正确的方向吗?

I'm at a total loss for next steps here, could someone point me in the right direction?

进一步研究了逐步运行手动构建的过程,我确实得到了这个特定步骤,不会出现以下错误:

Digging a bit more into running the build manually step by step, I did get this specific step to not error-out by:

  • 查找python二进制文件的位置(而不是pyenv使用的填充程序)
  • 手动运行日志中列出的clang命令,但将python.exe替换为我的python二进制文件的路径,即:/Users/username/.pyenv/versions/adid/bin/python2.7
  • Finding the location of the python binary (not the shim used by pyenv)
  • Manually running the clang command listed in the log, but replacing python.exe with the path to my python binary, ie: /Users/username/.pyenv/versions/adid/bin/python2.7

因此,似乎没有获取到python二进制文件的正确路径?不幸的是,我不知道构建过程的其余部分,所以我不能继续自己做下去,而且我也不知道如何将此路径校正放入setup.py运行的过程中.在更新到10.10之前我没有这些问题(可能是其他原因,已经过了几天,我做了其他事情),所以我不知道为什么这只是一个新问题.

So it seems it isn't getting some correct path to the python binary? Unfortunately I don't know the remainder of the build process so I can't keep going on my own, and I don't know how to place this path correction into the process run by setup.py. I didn't have these issues before updating to 10.10 (could have been something else, it's been a few days and I've done other stuff), so I don't know why this is only a new issue.

推荐答案

显然,这是我的virtualenv管理器出现的问题:

Apparently this is an issue with my virtualenv manager:

https://github.com/yyuu/pyenv/issues/273

Unable to install compiled Python modules under pyenv on OS X 10.10是问题的名称.

不,不是.

这是 python 的错误. python在OSX中进行OS版本比较的方法很幼稚,在10.10中用两位数打破,然后认为您使用的是旧版本的OSX.除了安装已编译模块(用于制定决策的位置)外,这通常可能不会引起注意.

This is a bug with python. The way python did os version comparisons in OSX was naive, and broke with the double digit in 10.10, where it would then think you were on a much older OSX. This can often go unnoticed, except when installing compiled modules (where it's used to make some decisions).

此问题已在此处修复: https://bugs.python.org/issue21811

This was fixed here: https://bugs.python.org/issue21811

我不记得2.7.7或2.7.8是发布的修复程序的版本(但它是其中之一),但是最终结果是您不能在OSX 10.10或更高版本上使用2.7的旧版本.较新的.如果您遇到此问题,那么我个人将推动升级使用的python版本;)(2.7.11仍然对ssl进行了一些很棒的改进).

I don't remember if 2.7.7 or 2.7.8 was the version with the released fix (but it was one of them), but the end result is you can't use older versions of 2.7 on OSX 10.10 or newer. If you're running into this issue then personally I'd push to upgrade the python version used ;) (2.7.11 has some awesome ssl improvements anyways).

这篇关于无法在Mac OS X 10.10上构建python gevent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆