简体   繁体   English

如何在离线电脑上安装tensorflow

[英]How to install tensorflow on a offline computer

I am trying to install tensorflow on a machine with no internet access: the machine has Windows 7 and Python 3.6 Anaconda.我正在尝试在无法访问互联网的机器上安装 tensorflow:该机器有 Windows 7 和 Python 3.6 Anaconda。

I tried different approaches but non of them worked.我尝试了不同的方法,但都没有奏效。

This what i did so far:这是我到目前为止所做的:

  • install anaconda with python 3.6使用 python 3.6 安装 anaconda
  • pip install tensorflow tensorflow-1.3.0-cp36-cp36m-win_and64.whl pip 安装 tensorflow tensorflow-1.3.0-cp36-cp36m-win_and64.whl

But when I try to import tensorflow i get the following error:但是当我尝试导入 tensorflow 时,出现以下错误:

ModuleNotFoundError: No module name google

I have read that I should install protobuf-3.6.tar.gz but I get the error :register_loader_type...我读过我应该安装protobuf-3.6.tar.gz但我收到错误:register_loader_type...

So I installed setuptools-3.6-py2.py3-none-any.whl所以我安装了setuptools-3.6-py2.py3-none-any.whl

and I still get the same error我仍然得到同样的错误

So my question is: is there any way to install tensorflow on a offline computer or there is something that I did wrong?所以我的问题是:有没有办法在离线计算机上安装 tensorflow 或者我做错了什么?

NOTE: I am admin on this offline machine注意:我是这台离线机器的管理员

python3 -m pip download tensorflow on a machine with internet with the same OS. python3 -m pip download tensorflow You will download all the needed packages to the current directory.您会将所有需要的包下载到当前目录。 Move the files onto a USB, mount the USB on the device without internet, and then do python3 -m pip install --no-index --find-links. tensorflow将文件移动到 USB 上,在没有互联网的情况下将 USB 挂载到设备上,然后执行python3 -m pip install --no-index --find-links. tensorflow python3 -m pip install --no-index --find-links. tensorflow in the directory with the copied .whl files.带有复制的python3 -m pip install --no-index --find-links. tensorflow文件的目录中的.whl

create anaconda conda virtul environment in some internet available system and install necessary package for your project and copy virtual environment to you system.在一些互联网可用系统中创建 anaconda conda virtul 环境并为您的项目安装必要的包并将虚拟环境复制到您的系统。 put inside anaconda env, it works放入anaconda env中,它可以工作

Requirements:- Bazel Installation , python >=2.7 and numpy.要求:- Bazel安装,python >=2.7 和 numpy。

You can use link .您可以使用链接 Installtion steps are given.给出了安装步骤。 I am explaining in more briefly:-我正在更简要地解释:-

  1. clone repo:- git clone https://github.com/amutu/tensorflow-offline.git克隆回购:- git clone https://github.com/amutu/tensorflow-offline.git
  2. Download tensorflow and tensorflow third party .(Note:-you have to download compatible version of tensorflow with tensorflow third party.)下载tensorflowtensorflow third party 。(注意:-您必须下载与tensorflow第三方兼容的tensorflow版本。)
  3. unzip them.解压缩它们。 In terminal run:- tf=/path/to/tensorflow/directory and tp=/path/to/tensorflow/third/party/directory .(Note:- you can check path typing $tf and $tp on terminal.)在终端运行中:- tf=/path/to/tensorflow/directorytp=/path/to/tensorflow/third/party/directory 。(注意:- 您可以在终端上输入 $tf 和 $tp 检查路径。)
    Example:- tp=/home/ai/Documents/vineet/test/tensorflow_third_party-1.2.1 tf=/home/ai/Documents/vineet/test/tensorflow-1.2.1示例:- tp=/home/ai/Documents/vineet/test/tensorflow_third_party-1.2.1 tf=/home/ai/Documents/vineet/test/tensorflow-1.2.1
  4. Run:- cd tensorflow-offline运行:- cd tensorflow-offline

  5. In tensorlfow offline run:- ./fix_offline_build.sh $tf $tp .(Note: you may also need to download tensorflow-port donwload it from here in tensorflow-port directory)在 tensorlfow 离线运行中:- ./fix_offline_build.sh $tf $tp 。(注意:您可能还需要从此处下载 tensorflow-port 并在 tensorflow-port 目录中下载它)

  6. Configure tensorflow using:- cd $tf &&./configure使用以下命令配置 tensorflow:- cd $tf &&./configure
  7. Build it using:- bazel --config=opt //tensorflow/tools/pip_package:build_pip_package --verbose_failures and bazel-bin/tensorflow/tools/pip_package/build_pip_package构建它使用:- bazel --config=opt //tensorflow/tools/pip_package:build_pip_package --verbose_failuresbazel-bin/tensorflow/tools/pip_package/build_pip_package

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM