0

我正在尝试安装 Deeplab 并在我的机器上运行它。我正在关注这个

我能够运行初始测试'python3 deeplab/model_test.py',但我得到了

没有名为 Tensorflow 的模块

运行下一步时出错,sh local_test.sh

Tensorflow 已安装在机器上,我尝试使用不同版本的 tensorflow 来验证任何不兼容问题。请建议我在哪里出错以及需要做什么才能成功运行它。

这是错误消息:

Traceback (most recent call last):
  File "/home/ssindhu/models/research/deeplab/model_test.py", line 18, in <module>
    import tensorflow as tf
ImportError: No module named tensorflow

但是机器上安装了tensorflow: pip show tensorflow给了我以下输出。

Name: tensorflow
Version: 1.13.1
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /home/ssindhu/.local/lib/python3.6/site-packages
Requires: six, astor, numpy, protobuf, tensorboard, tensorflow-estimator, termcolor, grpcio, wheel, keras-applications, gast, absl-py, keras-preprocessing
Required-by:
4

1 回答 1

0

首先,创建一个虚拟环境

pip install virtualenv
pip3 install virtualenv

现在为其环境创建一个新目录名称:

sudo mkdir enviornmrnts

进入这个目录(cd enviornments)并激活环境

virtualenv project1_env
source project1_env/bin/activate

现在这样做:

pip3 install -U --user pip six numpy wheel setuptools mock
pip3 install -U --user keras_applications==1.0.6 --no-deps
pip3 install -U --user keras_preprocessing==1.0.5 --no-deps


wget "https://github.com/bazelbuild/bazel/releases/download/0.24.0/bazel-0.24.0-installer-darwin-x86_64.sh"

chmod +x bazel-0.24.0-installer-darwin-x86_64.sh
./bazel-0.24.0-installer-darwin-x86_64.sh --user

export PATH="$PATH:$HOME/bin"

通过以下方式检查 bazel 版本

bazel version

************************************ 安装 Tensorflow**************** **************”

git clone https://github.com/tensorflow/tensorflow.git
git clone https://github.com/tensorflow/models.git

在这之后:

pip3 install -U tensorflow==1.8.0

要检查您的安装,请使用以下命令:

cd models/research
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
cd object_detection/
python3 builders/model_builder_test.py
于 2019-04-25T07:46:24.293 回答