简体   繁体   English

如何为 windows 7 32 位系统安装 tensorflow?我在我的系统中安装了 python 3.5(32 位)并安装了 anaconda 3.4.4(32 位)

[英]how to install tensorflow for windows 7 32bit system?i installed python 3.5(32 bit) into my system and also installed anaconda 3.4.4(32 bit)

i have only 32bit system so i installed python 3.5 (64 bit ) error occurs .so i installed python 32bit successfully after that i followed by that document( http://tensorflow.org/install/ …) i tried this into command prompt我只有 32 位系统,所以我安装了 python 3.5(64 位)错误。所以我成功安装了 python 32bit 之后我跟着那个文档( http://tensorflow.org/install/ ...)我尝试进入命令提示符

C:\Users\mydoc>pip3 install --upgrade tensorflow

but error occurs like this.但错误是这样发生的。

C:\Users\mydoc>pip install tensorflow

Collecting tensorflow
  Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

C:\Users\mydoc>

please help me how to install tensorflow for my windows (32-bit)system.请帮助我如何为我的 Windows(32 位)系统安装 tensorflow。

If using TensorFlow is not a hard requirement, you can consider changing back-ends for Keras.如果使用 TensorFlow 不是硬性要求,您可以考虑为 Keras 更改后端。 You will be able to use Theano as a back end, which has support for 32-bit windows.您将能够使用 Theano 作为后端,它支持 32 位窗口。 Find instructions for that here: https://keras.io/backend/在此处找到相关说明: https : //keras.io/backend/
I understand that this may not answer your question, but changing back-ends may be easier than changing computers.我知道这可能无法回答您的问题,但更改后端可能比更改计算机更容易。

How to install Tensorflow in a 32 bits linux system如何在 32 位 linux 系统中安装 Tensorflow

Following is a copy of the step list that I maintain in this github repository: tensorflow-32-bits-linux以下是我在这个 github 存储库中维护的步骤列表的副本: tensorflow-32-bits-linux

I used the following steps to install tensorflow in a old Asus Eee-Pc 1000H.我使用以下步骤在旧的 Asus Eee-Pc 1000H 中安装 tensorflow。 Granted, it has been upgraded from the original 1 GB of RAM and an 80 GB HDD, to 2 GB of RAM and to 480 GB of SSD storage, that runs Ubuntu Xenial 32 bits without problems.当然,它已经从最初的 1 GB RAM 和 80 GB HDD 升级到 2 GB RAM 和 480 GB SSD 存储,可以毫无问题地运行 Ubuntu Xenial 32 位。

I also has been able to install it in a Debian 9 (stretch) 32 bits system, and the instructions are the same.我也已经能够在 Debian 9 (stretch) 32 位系统中安装它,并且说明是相同的。

Choose a convenient linux system选择一个方便的linux系统

I have tested both the Ubuntu 16.04 (Xenial) and Debian 9.11 (Stretch) systems with 2 GB of RAM.我已经测试了具有 2 GB RAM 的 Ubuntu 16.04 (Xenial) 和 Debian 9.11 (Stretch) 系统。

I set up the system to have 4 GB of SWAP space.我将系统设置为具有 4 GB 的 SWAP 空间。 With only 1 GB of SWAP, some compilations failed.只有 1 GB 的 SWAP,一些编译失败。

It's critical that the distribution has the version 8 of the Java SDK: openjdk-8-jdk发行版具有 Java SDK 的第 8 版至关重要:openjdk-8-jdk

Install the Java 8 SDK and build tools安装 Java 8 SDK 和构建工具

sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo apt-get install git zip unzip autoconf automake libtool curl zlib1g-dev swig build-essential

Install Python libraries安装 Python 库

Next, we install python 3 development libraries and the keras module that will be required by tensorflow.接下来,我们安装 python 3 开发库和 tensorflow 所需的 keras 模块。

sudo apt-get install python3-dev python3-pip python3-wheel
sudo python3 -m pip install --upgrade pip
python3 -m pip install --user keras

You can use eithr python 3 or python 2 and compile tensorflow for that version.您可以使用 eithr python 3 或 python 2 并为该版本编译 tensorflow。

Install and compile Bazel from sources从源代码安装和编译 Bazel

We need the source code bazel 0.19.2 distribution.我们需要bazel 0.19.2发行版的源代码。 We can obtain it and install in a new folder.我们可以获取它并安装在一个新文件夹中。

wget https://github.com/bazelbuild/bazel/releases/download/0.19.2/bazel-0.19.2-dist.zip
mkdir Bazel-0-19.2
cd Bazel-0-19.2
unzip ../bazel-0.19.2-dist.zip

Before compiling, we need to remove line 30 of ./src/tools/singlejar/mapped_file_posix.inc file ( #error This code for 64 bit Unix. ) that throws an error if we are not in a 64 bit machine.在编译之前,我们需要删除 ./src/tools/singlejar/mapped_file_posix.inc 文件的第 30 行( #error This code for 64 bit Unix. ),如果我们不是在 64 位机器上,它会抛出错误。 This bazel version works ok in 32 bits.这个 bazel 版本在 32 位上运行正常。

Also we need to increase the java memory available to Bazel and start compiling it.我们还需要增加 Bazel 可用的 Java 内存并开始编译它。

export BAZEL_JAVAC_OPTS="-J-Xmx1g"
./compile.sh

When it finishes (It can take several hours), we move the bazel compiled executable to some location in the current user's path完成后(可能需要几个小时),我们将 bazel 编译的可执行文件移动到当前用户路径中的某个位置

cp output/bazel /home/user/.local/bin

Compile Tensorflow from sources从源代码编译 Tensorflow

Create a folder and clone tensorflow's 1.13.2 version to it.创建一个文件夹并将 tensorflow 的 1.13.2 版本克隆到它。 Starting from version 1.14, tensorflow uses the Intel MKL DNN optimization library that it only works in 64 bits systems.从 1.14 版开始,tensorflow 使用 Intel MKL DNN 优化库,它仅适用于 64 位系统。 So 1.13.2 is the last version that runs in 32 bits.所以 1.13.2 是最后一个以 32 位运行的版本。

mkdir Tensorflow-1.13.2
cd Tensorflow-1.13.2
git clone -b v1.13.2 --depth=1 https://github.com/tensorflow/tensorflow .

Before compiling, we replace the references to 64 bit libraries to the 32 bit ones.在编译之前,我们将对 64 位库的引用替换为 32 位库。

grep -Rl "lib64"| xargs sed -i 's/lib64/lib/g'

We start the tensorflow configuration.我们开始 tensorflow 配置。 We need to explicity disable the use of several optional libraries that are not available or not supported on 32 bit systems.我们需要明确禁止使用在 32 位系统上不可用或不支持的几个可选库。

export TF_NEED_CUDA=0
export TF_NEED_AWS=0
./configure

We have to take the following considerations: * When asked to specify the location of python.我们必须考虑以下几点: * 当要求指定 python 的位置时。 [Default is /usr/bin/python]: We should respond /usr/bin/python3 to use python 3. * When asked to input the desired Python library path to use. [默认为/usr/bin/python]:我们应该响应/usr/bin/python3使用python 3。 * 当要求输入要使用的所需Python 库路径时。 Default is [/usr/local/lib/python3.5/dist-packages] we just hit Enter * We should respond N to all the Y/N questions.默认为[/usr/local/lib/python3.5/dist-packages]我们只需要敲击回车*我们应该响应N到所有Y / N的问题。 * When asked to specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native -Wno-sign-compare]: Just hit Enter * 当在指定 bazel 选项“--config=opt”时要求指定要在编译期间使用的优化标志 [默认为 -march=native -Wno-sign-compare]:只需按 Enter

Now we start compiling tensorflow disabling optional components like aws, kafka, etc.现在我们开始编译 tensorflow,禁用可选组件,如 aws、kafka 等。

bazel build --config=noaws --config=nohdfs --config=nokafka --config=noignite --config=nonccl -c opt --verbose_failures //tensorflow/tools/pip_package:build_pip_package

If everything went ok, now we generate the pip package.如果一切顺利,现在我们生成 pip 包。

bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

And we install the pip package然后我们安装 pip 包

python3 -m pip install --user /tmp/tensorflow_pkg/tensorflow-1.13.2-cp35-cp35m-linux_i686.whl

Test tensorflow测试张量流

Now we run a small test to check that it works.现在我们运行一个小测试来检查它是否有效。 We create a test.py file with the following contents:我们创建一个包含以下内容的 test.py 文件:

import tensorflow as tf

mnist = tf.keras.datasets.mnist

(x_train, y_train),(x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0

model = tf.keras.models.Sequential([
  tf.keras.layers.Flatten(input_shape=(28, 28)),
  tf.keras.layers.Dense(512, activation=tf.nn.relu),
  tf.keras.layers.Dropout(0.2),
  tf.keras.layers.Dense(10, activation=tf.nn.softmax)
])

model.compile(optimizer='adam',
              loss='sparse_categorical_crossentropy',
              metrics=['accuracy'])

model.fit(x_train, y_train, epochs=5)
model.evaluate(x_test, y_test)

And we run the test我们运行测试

python3 test.py

Here is the output这是输出

Epoch 1/5
60000/60000 [==============================] - 87s 1ms/sample - loss: 0.2202 - acc: 0.9348
Epoch 2/5
60000/60000 [==============================] - 131s 2ms/sample - loss: 0.0963 - acc: 0.9703
Epoch 3/5
60000/60000 [==============================] - 135s 2ms/sample - loss: 0.0685 - acc: 0.9785
Epoch 4/5
60000/60000 [==============================] - 128s 2ms/sample - loss: 0.0526 - acc: 0.9828
Epoch 5/5
60000/60000 [==============================] - 128s 2ms/sample - loss: 0.0436 - acc: 0.9863
10000/10000 [==============================] - 3s 273us/sample - loss: 0.0666 - acc: 0.9800

Enjoy you new Tensorflow !!享受你的新 Tensorflow !!

This question is already answered: 这个问题已经回答了:

We have only tested the TensorFlow distribution on 64-bit Linux and Mac OS X, and distribute binary packages for those platforms only.我们只在 64 位 Linux 和 Mac OS X 上测试了 TensorFlow 发行版,并且只为这些平台发行了二进制包。 Try following the source installation instructions to build a version for your platform.尝试按照源安装说明为您的平台构建一个版本。

EDIT : One user has published instructions for running TensorFlow on a 32-bit ARM processor , which is promising for other 32-bit architectures.编辑:一位用户发布了在 32 位 ARM 处理器上运行 TensorFlow 的说明,这对其他 32 位架构很有希望。 These instructions may have useful pointers for getting TensorFlow and Bazel to work in a 32-bit environment.这些说明可能具有让 TensorFlow 和 Bazel 在 32 位环境中工作的有用指针。

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

相关问题 如何让 anaconda 使用安装在我的系统上的 python3.9.2(64 位),但 Anaconda 将 python 3.8.8(32 位)作为默认使用? - How can I make anaconda use python3.9.2(64 bit) which is installed on my system but Anaconda gives python 3.8.8(32 bit) as default being used? 如何在 windows 10 上使用 VirtualEnv 安装 python 3.7 32Bit - How to install python 3.7 32Bit with VirtualEnv on windows 10 如何在 anaconda 64bit 旁边安装 python 32bit - How to install python 32bit alongside anaconda 64bit 尝试在Windows 7 64位(Python 3.4.4 32位)上使用GDAL时出现“ ImportError:DLL加载失败” - “ImportError: DLL load failed” when trying to use GDAL on Windows 7 64bit (Python 3.4.4 32bit) django是否为Windows 7(32位)安装了安装了python 3.3的安装程序? - Does django have an installer for windows 7(32 bit) with python 3.3 installed? 使用多个 Python 引擎(32Bit/64bit 和 2.7/3.5) - Using multiple Python engines (32Bit/64bit and 2.7/3.5) Python 3.5 32和64位 - Scipy和Tensorflow问题 - Python 3.5 32 & 64 bit — Scipy & Tensorflow issues WinPython 32位下载 - WinPython 32bit download 如何将.py 转换为.exe(32 位) - How to convert .py to .exe (32bit) 在 32 位 Windows 7 机器上的 Python 3.5 中安装 scipy - Installing scipy in Python 3.5 on 32-bit Windows 7 Machine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM