0

我正在使用 Pants 为我的项目创建 .pex 文件。我的构建文件使用 3rdparty 逻辑依赖于 pyarrow:'3rdparty/python:pyarrow'。Pants 使用 C++ 和 Python 库构建 pyarrow,我在 anaconda 中安装了 pyarrow,而不是在标准 python 库中。Pyprep interpreter.info 给出:/usr/bin/python2.7 作为 Pants 中使用的解释器。如何将其更改为 anaconda python?

4

1 回答 1

0

Changing the pyprep interpreter changes depending on your version of Pants. If this is a relatively recent version, you can set the interpreters in config.

Below is the pattern I have used to override the interpreters, in this case supporting Python2 and Python3 (The %(buildroot)s is a Pants config built-in).

[python-setup]
# Using the modern Pants python backend will allow us to set:
#   compatibility=[ "CPython>=3" ]
# on any python_target we want to enforce as Python3.
interpreter_constraints: ["CPython>=2.7,<3"]
interpreter_search_paths: [
   '%(buildroot)s/.venv/py2/bin',
   '%(buildroot)s/.venv/py3/bin',
  ]

Using roughly the same config, but point it towards the anaconda path will override the interpreter.

I am not sure that this will do what you want - but it will do what you asked.

于 2018-11-13T23:21:44.730 回答