[英]Run tensorflow on linux by python3 pip
I have installed python and tensorflow on my linux, This is my all step that I done:我已经在我的 linux 上安装了 python 和 tensorflow,这是我完成的所有步骤:
sudo apt install python3 python3.pip
sudo pip3 install ––upgrade pip
pip3 install ––upgrade setuptools
pip3 install tensorflow
pip3 install keras
This version of tensorflow and keras is installed:此版本的 tensorflow 和 keras 安装:
Alt@mx:/mnt/Project/ML/AE
$ pip3 show tensorflow
Name: tensorflow
Version: 2.4.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: /home/Alt/.local/lib/python3.7/site-packages
Requires: keras-preprocessing, wrapt, gast, tensorboard, six, google-pasta, h5py, typing-extensions, tensorflow-estimator, astunparse, wheel, opt-einsum, grpcio, protobuf, flatbuffers, termcolor, absl-py, numpy
Required-by:
And:和:
Alt@mx:/mnt/Project/ML/AE
$ pip3 show keras
Name: Keras
Version: 2.4.3
Summary: Deep Learning for humans
Home-page: https://github.com/keras-team/keras
Author: Francois Chollet
Author-email: francois.chollet@gmail.com
License: MIT
Location: /home/Alt/.local/lib/python3.7/site-packages
Requires: pyyaml, h5py, scipy, numpy
Required-by:
Alt@mx:/mnt/Project/ML/AE
I create a simple code on vscode:我在 vscode 上创建了一个简单的代码:
import tensorflow as tf
hello = tf.constant("Hello, TensorFlow!")
sess = tf.Session()
print(sess.run(hello))
But when I run it by vscode I got:但是当我通过 vscode 运行它时,我得到了:
Alt@mx:/mnt/Project/ML/AE
$ /usr/bin/python3 /mnt/Project/ML/AE/simple_auto_encoder.py
Illegal instruction
Alt@mx:/mnt/Project/ML/AE
What is my mistake?我的错误是什么?
This problem may refer to the instruction set that the binary supports.这个问题可能与二进制支持的指令集有关。 Check the compatibility with your CPU.检查与您的 CPU 的兼容性。 For more information check this .有关更多信息,请查看此。
I would also like to mention that you don't have to install separately the keras
library because it is included in tensorflow
.我还想提一下,您不必单独安装keras
库,因为它包含在tensorflow
中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.