terryzhao127 / tensorflow-windows-build-script

A script to automate building Tensorflow on Windows and solve some problems
GNU General Public License v3.0
102 stars 35 forks source link
tensorflow tensorflow-windows

Tensorflow Windows Build Script

Building Tensorflow on Windows is really a tough thing and there should be many problems to solve. Thus, this script automates the process of building on Windows, which does the following things for you:

This script has been tested on v1.13.1, v1.12.0 and v1.11.0.

However, this script may work on several unsupported versions. If you did this and succeeded, it would be nice of you to add your configurations to the script by pull requests! Through Bulletin Board

Getting Started

Prerequisites

You may need to do some preparations below:

Building

  1. Clone this repository or directly download it.
  2. Run the script in the repository directory with administrator rights.

    .\build.ps1 -BazelBuildParameters <parameter_string> [optional_parameters]
    • When you encounter Make sure you have installed same version of $ExeName $RequiredVersion, make sure you have installed same version of what we recommend, otherwise we advise you to uninstall your installed ones and re-run the script which will automatically install recommended ones. Or you can proceed with high possibility to get stuck in problems. After having cleared the version issues, you must be glad to add -IgnoreDepsVersionIssues flag next time.

      Considering that not every installed software is installed by chocolatey, we cannot automate the uninstallation process for you. On the other hand, if some of your installed ones are indeed choco packages, please view chocolatey docs to uninstall them manually.

  3. The output files should be in source\bazel-bin folder. View wiki to find some advice on how to use the built results.

Details of Parameters

Example

# It is an example for building C++ API with GPU support.
$parameterString = "--config=opt --config=cuda --define=no_tensorflow_py_deps=true --copt=-nvcc_options=disable-warnings //tensorflow:libtensorflow_cc.so --verbose_failures"
.\build.ps1 `
    -BazelBuildParameters $parameterString `
    -BuildCppAPI -ReserveSource -ReserveVenv

Known Issues

Acknowledgements

Bulletin Board