简体   繁体   中英

How do you install Bazel in python2 environment?

How do you install Bazel in a python2 environment? The tensorflow website has an error posted on the such as this "Caution: Because of an bazel bug, we only support building the Android demo app within a Python 2 environment", (See related Bazel installation on windows">Bazel installation on Windows). How do you install Bazel in a python2 environment( to get apps working on Windows, using bazel)? The Bazel install in a python2 environment may be a workaround for the error shown earlier on the Tensorflow website, they do not seem to have any other workarounds known.

  1. Download and install Python2 (eg from python.org: Python 2.7.15, 64-bit version [1])
  2. Use the --python_path flag [2] to tell Bazel where's the Python interpreter.

For example if you installed Python2 under c:\\python2 , run Bazel like so:

c:\tensorflow> bazel build --python_path=c:/python2/python.exe //foo:bar

If you want Bazel to always use this flag in this workspace ( c:\\tensorflow ), add the following line to c:\\tensorflow\\.bazelrc :

build --python_path=c:/python2/python.exe

(You may need to add this line every time you re-run the configure script.)

Update: here's more info about .bazelrc files [3], what they are, where they are, how to specify them.


[1] https://www.python.org/ftp/python/2.7.15/python-2.7.15.amd64.msi

[2] https://docs.bazel.build/versions/master/command-line-reference.html

[3] https://docs.bazel.build/versions/master/user-manual.html#bazelrc

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