简体   繁体   中英

Set pants interpreter for Pyarrow

I am using Pants to create .pex file for my project. My Build file has dependency for pyarrow using 3rdparty logic:'3rdparty/python:pyarrow'. Pants build pyarrow using both C++ and Python libraries, I have pyarrow install in anaconda not in standard python library. Pyprep interpreter.info gives: /usr/bin/python2.7 as interpreter used in Pants. How can I change it to anaconda python?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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