Windows bazel says python is not an executable when building
The error message you are seeing suggests that Bazel is unable to locate the Python executable specified in the PATH environment variable.

Here are a few things you can try to fix the issue:

1. Verify that the Python executable is in your PATH: Make sure that the directory containing the Python executable is actually included in your PATH environment variable. You can verify this by running echo %PATH% in the Command Prompt and checking whether the directory containing the Python executable is listed. Next, Use the full path to the Python executable: Instead of relying on the PATH environment variable, you can try specifying the full path to the Python executable in the configure.py script. For example, you can try running python configure.py --interpreter=C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe.

2.Try using a different version of Python: It's possible that the version of Python you are using is not compatible with TensorFlow. You can try using a different version of Python (e.g., Python 3.7) and see if that resolves the issue and check your Bazel version: Make sure that you are using the correct version of Bazel that is compatible with TensorFlow 2.12. You can check the Bazel version requirements in the TensorFlow documentation.

If all fails, then try using a pre-built TensorFlow package: If you are still having issues building TensorFlow from source, you can try using a pre-built TensorFlow package instead. You can download pre-built TensorFlow packages for Windows from the TensorFlow website. Hi @TurgutBababalim, As per the official documentation, Tensorflow 2.12 is compatible with Bazel 5.3.0. Please try again with the supported versions. Kindly refer to the [tested build configurations](https://www.tensorflow.org/install/source_windows#cpu).  Thank you!  This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60263">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60263">No</a>

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Build/Install

### Have you reproduced the bug with TF nightly?

No

### Source

source

### Tensorflow Version

r2.12

### Custom Code

No

### OS Platform and Distribution

Widnows 10

### Mobile device

Asus pc

### Python version

3.11

### Bazel version

6.1.1

### GCC/Compiler version

msbuild 17.5.1+f6fdcf537

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

```shell
I'm trying to build c++ tflite for windows using bazel by following the [official documentation][1]. So far I've installed everything it want's me to and added them to `PATH`. Then I cloned the github repo and checked out to `r2.12` branch.

Then I ran `python ./configure.py` and selected default for everything (said yes to override eigen strong inline). When doing so it declared that my python is located on `C:\Users\Asus\AppData\Local\Programs\Python\Python311\python.exe`.

After that running `bazel build -c opt //tensorflow/lite:tensorflowlite` on the directory where I've cloned tensorflow in cmd casuses the below error:


I checked whether python was there or not, it indeed is. Simply running `C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe` in cmd indeed opens python. 

So I checked the internet for some solutions, I've removed the "python installers" from my system, added python to PATH, tried the same steps with tensorflow source zip instead of cloning it, nothing works. 

Some people suggested chaning some stuff inside the `py` directory of tensorflow but it didn't work aswell.

Why is this happening? What causes bazel to not see python even though it's there? How can I fix this and get a build with windows?


  [1]: https://www.tensorflow.org/install/source_windows
```


### Standalone code to reproduce the issue

```shell
Steps I've followed: 

- run:
`pip3 install -U six numpy wheel packaging
pip3 install -U keras_preprocessing --no-deps`

- Install bazel 6.1.1 and add it to PATH.

- Install MSYS2 and add bin to PATH.

- Install visual studio and setup the needed tools.

-git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow

- git checkout r2.12

- bazel build -c opt //tensorflow/lite:tensorflowlite
```


### Relevant log output

```shell
Starting local Bazel server and connecting to it...
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=117
INFO: Reading rc options for 'build' from c:\users\asus\desktop\tensorflow\.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Options provided by the client:
  'build' options: --python_path=C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe
INFO: Reading rc options for 'build' from c:\users\asus\desktop\tensorflow\.bazelrc:
  'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from c:\users\asus\desktop\tensorflow\.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe --action_env PYTHON_LIB_PATH=C:/Users/Asus/AppData/Local/Programs/Python/Python311/Lib/site-packages --python_path=C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions --define=override_eigen_strong_inline=true
INFO: Reading rc options for 'build' from c:\users\asus\desktop\tensorflow\.bazelrc:
  'build' options: --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/eager,tensorflow/core/tfrt/eager/backends/cpu,tensorflow/core/tfrt/eager/backends/gpu,tensorflow/core/tfrt/eager/core_runtime,tensorflow/core/tfrt/eager/cpp_tests/core_runtime,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils
INFO: Found applicable config definition build:short_logs in file c:\users\asus\desktop\tensorflow\.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file c:\users\asus\desktop\tensorflow\.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:windows in file c:\users\asus\desktop\tensorflow\.bazelrc: --copt=/W0 --host_copt=/W0 --copt=/Zc:__cplusplus --host_copt=/Zc:__cplusplus --copt=/D_USE_MATH_DEFINES --host_copt=/D_USE_MATH_DEFINES --features=compiler_param_file --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 --config=monolithic --copt=-DWIN32_LEAN_AND_MEAN --host_copt=-DWIN32_LEAN_AND_MEAN --copt=-DNOGDI --host_copt=-DNOGDI --copt=/Zc:preprocessor --host_copt=/Zc:preprocessor --linkopt=/DEBUG --host_linkopt=/DEBUG --linkopt=/OPT:REF --host_linkopt=/OPT:REF --linkopt=/OPT:ICF --host_linkopt=/OPT:ICF --verbose_failures --features=compiler_param_file --distinct_host_configuration=false
INFO: Found applicable config definition build:monolithic in file c:\users\asus\desktop\tensorflow\.bazelrc: --define framework_shared_object=false --define tsl_protobuf_header_only=false --experimental_link_static_libraries_once=false
INFO: Repository local_config_python instantiated at:
  C:/users/asus/desktop/tensorflow/WORKSPACE:15:14: in <toplevel>
  C:/users/asus/desktop/tensorflow/tensorflow/workspace2.bzl:957:19: in workspace
  C:/users/asus/desktop/tensorflow/tensorflow/workspace2.bzl:104:21: in _tf_toolchains
Repository rule python_configure defined at:
  C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl:298:35: in <toplevel>
ERROR: An error occurred during the fetch of repository 'local_config_python':
   Traceback (most recent call last):
        File "C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl", line 271, column 40, in _python_autoconf_impl
                _create_local_python_repository(repository_ctx)
        File "C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl", line 212, column 22, in _create_local_python_repository
                _check_python_bin(repository_ctx, python_bin)
        File "C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl", line 145, column 25, in _check_python_bin
                auto_config_fail("--define %s='%s' is not executable. Is it the python binary?" % (
        File "C:/users/asus/desktop/tensorflow/third_party/remote_config/common.bzl", line 12, column 9, in auto_config_fail
                fail("%sConfiguration Error:%s %s\n" % (red, no_color, msg))
Error in fail: Configuration Error: --define PYTHON_BIN_PATH='C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe' is not executable. Is it the python binary?
ERROR: C:/users/asus/desktop/tensorflow/WORKSPACE:15:14: fetching python_configure rule //external:local_config_python: Traceback (most recent call last):
        File "C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl", line 271, column 40, in _python_autoconf_impl
                _create_local_python_repository(repository_ctx)
        File "C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl", line 212, column 22, in _create_local_python_repository
                _check_python_bin(repository_ctx, python_bin)
        File "C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl", line 145, column 25, in _check_python_bin
                auto_config_fail("--define %s='%s' is not executable. Is it the python binary?" % (
        File "C:/users/asus/desktop/tensorflow/third_party/remote_config/common.bzl", line 12, column 9, in auto_config_fail
                fail("%sConfiguration Error:%s %s\n" % (red, no_color, msg))
Error in fail: Configuration Error: --define PYTHON_BIN_PATH='C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe' is not executable. Is it the python binary?
INFO: Repository local_execution_config_python instantiated at:
  C:/users/asus/desktop/tensorflow/WORKSPACE:15:14: in <toplevel>
  C:/users/asus/desktop/tensorflow/tensorflow/workspace2.bzl:957:19: in workspace
  C:/users/asus/desktop/tensorflow/tensorflow/workspace2.bzl:94:27: in _tf_toolchains
  C:/users/asus/desktop/tensorflow/tensorflow/tools/toolchains/remote_config/configs.bzl:6:28: in initialize_rbe_configs
  C:/users/asus/desktop/tensorflow/tensorflow/tools/toolchains/remote_config/rbe_config.bzl:158:27: in _tensorflow_local_config
Repository rule local_python_configure defined at:
  C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl:279:41: in <toplevel>
INFO: Repository go_sdk instantiated at:
  C:/users/asus/desktop/tensorflow/WORKSPACE:23:14: in <toplevel>
  C:/users/asus/desktop/tensorflow/tensorflow/workspace0.bzl:134:20: in workspace
  C:/users/asus/_bazel_asus/ddsftcyc/external/com_github_grpc_grpc/bazel/grpc_extra_deps.bzl:36:27: in grpc_extra_deps
  C:/users/asus/_bazel_asus/ddsftcyc/external/io_bazel_rules_go/go/private/sdk.bzl:431:28: in go_register_toolchains
  C:/users/asus/_bazel_asus/ddsftcyc/external/io_bazel_rules_go/go/private/sdk.bzl:130:21: in go_download_sdk
Repository rule _go_download_sdk defined at:
  C:/users/asus/_bazel_asus/ddsftcyc/external/io_bazel_rules_go/go/private/sdk.bzl:117:35: in <toplevel>
ERROR: Analysis of target '//tensorflow/lite:tensorflowlite' failed; build aborted: Configuration Error: --define PYTHON_BIN_PATH='C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe' is not executable. Is it the python binary?
INFO: Elapsed time: 224.163s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (32 packages loaded, 15 targets configured)
```
</details>