【问题标题】:Run tensorflow on linux by python3 pip通过 python3 pip 在 linux 上运行 tensorflow
【发布时间】:2021-01-13 11:20:34
【问题描述】:

我已经在我的 linux 上安装了 python 和 tensorflow,这是我完成的所有步骤:

sudo apt install python3 python3.pip
sudo pip3 install ––upgrade pip
pip3 install ––upgrade setuptools
pip3 install tensorflow
pip3 install keras

安装了这个版本的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: 

还有:

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

我在 vscode 上创建了一个简单的代码:

import tensorflow as tf
hello = tf.constant("Hello, TensorFlow!")
sess = tf.Session()
print(sess.run(hello))

但是当我通过 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

我的错误是什么?

【问题讨论】:

    标签: python-3.x linux tensorflow deep-learning


    【解决方案1】:

    这个问题可能与二进制支持的指令集有关。检查与您的 CPU 的兼容性。 更多信息请查看this

    我还想提一下,您不必单独安装 keras 库,因为它包含在 tensorflow 中。

    【讨论】:

    • 我可以通过 anaconda 运行 tensorflow,但我想在没有 anaconda 的情况下使用 @NewLow
    • 那是因为 anaconda 可能使用的是您从 pip 获得的最新版本的早期版本。尝试安装较早的版本,看看问题是否得到解决。也检查一下。 github.com/tensorflow/tensorflow/issues/45744
    猜你喜欢
    • 2022-01-25
    • 2022-01-14
    • 2017-05-22
    • 1970-01-01
    • 2023-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多