title: How to stop bazel from relying on Python2
body: <p>when running <code>bazel test</code> Bazel seems to default to Python 2 even when <code>--python-version</code> flag is specified</p>
  <pre><code>bazel test //... --python_version PY3
  </code></pre>
  <pre><code>INFO: From Testing //test:py-unit-tests:
  ==================== Test output for //test:py-unit-tests:
  /usr/bin/env: 'python': No such file or directory
  </code></pre>
  <p>This is my BUILD file</p>
  <pre><code>py_test(
      name = &quot;py-unit-tests&quot;,
      srcs = glob([&quot;unit/**/*.py&quot;]),
      deps = [
      ],
      main = &quot;unit/unit_test_runner.py&quot;,
      timeout = &quot;short&quot;,
  )
  </code></pre>
  <p>And the test file</p>
  <pre><code>import sys
  import unittest
  
  
  class TestGeneration(unittest.TestCase):
      def test_base(self):
          pass
      def test_urdf(self):
          self.assertEqual(&quot;hello&quot;, 'test')
  
  
  if __name__ == '__main__':
      unittest.main()
  </code></pre>
  <p>Bazel version: 3.3.1</p>
  <hr />
  <p>Other notable things:</p>
  <ol>
  <li><p>My system has both py2 and py3 installed</p>
  </li>
  <li><p>Py3 is located at <code>/usr/bin/python3</code></p>
  </li>
  <li><p>Py2 is located at  <code>/usr/bin/python2</code></p>
  </li>
  </ol>
  <p>There is no <code>/usr/bin/python</code></p>