我用的裤子版本0.0.32 +再多几次来自师父的投稿。
我想使用一个在Linux和MacOS支持中捆绑的pex发行版。我正在用Pants回购工具建造pex:
git clean -fdx
PANTS_DEV=1 ./pants binary ./src/python/pants/bin:pants我使用了新创建的文件dist/pants.pex,它在我的mac上运行得很好。当我试图在Linux环境中运行它时,它退出时会出现一个错误:
./pants test foo
Running Pants version square-20150331-02
...
11:53:22 00:08 [pytest]
11:53:22 00:08 [run]
WARN] /data/app/kochiku-worker/.pex/install/requests-2.5.3-py2.py3-none-any.whl.ed9d28acc3c467062b25b9dc2e2084d6efa8ee1e/requests-2.5.3-py2.py3-none-any.whl/requests/packages/urllib3/connection.py:251: SecurityWarning: Certificate has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
SecurityWarning
FAILURE: Unable to detect a suitable interpreter for compatibilities: (Conflicting targets: )
[32m
Waiting for background workers to finish.[0m[31m
FAILURE[0m我认为这里发生的事情是,由于某种原因,裤子在Python2.6下运行。我研究了安全错误,在使用python 2.7.2之前使用python版本时,它可能会意外地被绊倒。我试图使用的机器上安装的python版本安装在/usr/local/bin中,版本为2.7.9
发布于 2015-04-03 00:01:56
好的-在0.0.32版本的失败消息中,我发现了这个task.py代码:
def select_interpreter_for_targets(self, targets):
"""Pick an interpreter compatible with all the specified targets."""
allowed_interpreters = OrderedSet(self.interpreter_cache.interpreters)
targets_with_compatibilities = [] # Used only for error messages.
# Constrain allowed_interpreters based on each target's compatibility requirements.
for target in targets:
if target.is_python and hasattr(target, 'compatibility') and target.compatibility:
targets_with_compatibilities.append(target)
compatible_with_target = list(self.interpreter_cache.matches(target.compatibility))
allowed_interpreters &= compatible_with_target
if not allowed_interpreters:
# Create a helpful error message.
unique_compatibilities = set(tuple(t.compatibility) for t in targets_with_compatibilities)
unique_compatibilities_strs = [','.join(x) for x in unique_compatibilities if x]
targets_with_compatibilities_strs = [str(t) for t in targets_with_compatibilities]
raise TaskError('Unable to detect a suitable interpreter for compatibilities: %s '
'(Conflicting targets: %s)' % (' && '.join(unique_compatibilities_strs),
', '.join(targets_with_compatibilities_strs)))allowed_interpreters从interpreter_cache返回为空,该代码查看配置值,这些配置值的键最近发生了更改,以便引导解释器。我猜您的回购中有一个pants.ini配置,丢失了键名的更改。
在pantsbuild中有一个检查陈旧pants.ini配置键的工具。您可以在pantsbuild/pants的克隆体中运行它,并指向您自己的回购的pants.ini,如下所示:
$ ./pants run src/python/pants/option/:migrate_config -- [path to your repo's pants.ini]我最近在升级twitter/commons时就这样做了。对更改进行了检查,这里和工具输出如下:
$ ./pants run src/python/pants/option/:migrate_config -- ~/dev-jsirois-commons/pants.ini
...
17:53:44 00:00 [run]
17:53:44 00:00 [py]
17:53:44 00:00 [chroot]
17:53:44 00:00 [run]
Checking config file at /home/jsirois/dev-jsirois-commons/pants.ini for unmigrated keys.
Found indices in section [python-repos]. Should be indexes in section [python-repos].
17:53:44 00:00 [jvm]
17:53:44 00:00 [cpp-run]
SUCCESS注意Found indices in section [python-repos]. Should be indexes in section [python-repos]。您可能也有同样的未迁移的inidices键绊倒您。
发布于 2015-04-02 23:40:19
您可以使用环境变量PEX_VERBOSE=1运行--这将为您提供更多关于使用哪个版本运行的Python的信息。您的系统Python也可能被错误地配置为使用2.6中的库。
作为一个核心选项,您可以尝试使用python.sh来查看它是否有助于修复您的python环境。
https://stackoverflow.com/questions/29416441
复制相似问题