本文主要是介绍bazel 安装与手动安装tensorflow,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1 . 安装bazel 需要的jdk-8
sudo apt-get install openjdk-8-jdk
在Ubuntu 14.04 LTS上,您必须使用PPA:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update && sudo apt-get install oracle-java8-installer
第2步:添加Bazel分发URI作为包源
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
如果您想安装Bazel的测试版本,请stable用testing。
第3步:安装并更新Bazel
sudo apt-get update && sudo apt-get install bazel
安装完成后,可以使用以下命令升级到较新版本的Bazel:
sudo apt-get upgrade bazel
方法2:
安装固定的版本
$ BAZEL_VERSION="0.26.0" # insert your desired version here, for example 0.26.0
$ wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh # if not on x86_64, change that too
$ chmod +x bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh # or the file you just downloaded
$ ./bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh
$ bazel version # this should now print the same as BAZEL_VERSION
手动编译安装 TensorFlow
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package --verbose_failures# 构建 whl 包
bazel-bin/tensorflow/tools/pip_package/build_pip_package ~/tmp# 安装tensorflow
pip install ~/tmp/tensorflow-2.0.1-cp37-cp37m-linux_x86_64.whl --user
这篇关于bazel 安装与手动安装tensorflow的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!