dawncc / TensorFlowTest

0 stars 0 forks source link

Bazel #8

Open dawncc opened 7 years ago

dawncc commented 7 years ago

Chocolatey

Windows下的包管理器 https://chocolatey.org/ 用管理员权限使用cmd输入命令安装

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

如果要指定安装目录, 需要新建个环境变量ChocolateyInstall,并手动创建目录

dawncc commented 7 years ago

msys2

MSYS2 is a software distro and building platform for Windows: http://www.msys2.org/

配置国内镜像

# 编辑 /etc/pacman.d/mirrorlist.mingw32 ,在文件开头添加:
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686
# 编辑 /etc/pacman.d/mirrorlist.mingw64 ,在文件开头添加:
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64
# 编辑 /etc/pacman.d/mirrorlist.msys ,在文件开头添加:
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch
# 刷新更新
pacman -Sy 

更新数据源

pacman -Syu

安装gcc/gdb/make

pacman -S mingw32/mingw-w64-i686-gcc

pacman -S mingw32/mingw-w64-i686-gdb

pacman -S mingw32/mingw-w64-i686-make

配置bash地址

BAZEL_SH=c:/tools/msys64/usr/bin/bash.exe

这样就可以直接在命令行直接输入bash了。

dawncc commented 7 years ago

Bazel

使用Chocolatey安装

choco install bazel

https://www.bazel.build/ 安装问题参照:https://docs.bazel.build/versions/master/windows.html#requirements window安装前,需要配置系统参数

export JAVA_HOME="$(ls -d C:/Program\ Files/Java/jdk* | sort | tail -n 1)"
export BAZEL_SH=c:/tools/msys64/usr/bin/bash.exe
export PATH=c:/tools/msys64/usr/bin
dawncc commented 7 years ago

Tenorflow Serving

从源码安装

git clone --recurse-submodules https://github.com/tensorflow/serving
cd serving

使用bazel编译serving

bazel build tensorflow_serving/...

报错: 原因是tensorflow要与tensorflow-serving在同一目录下

ERROR: error loading package '': Encountered error while reading extension file 'tensorflow/workspace.bzl': no such package '@org_tensorflow//tensorflow': No WORKSPACE file found in C:/users/cc/appdata/local/temp/_bazel_cc/c-ywu5vk/external/org_tensorflow.
INFO: Elapsed time: 0.536s