在运行deeplab代码时运行``sh local_test.sh''命令时,出现``没有名为Tensorflow的模块''错误

时间:2019-04-17 19:35:53

标签: conv-neural-network image-segmentation semantic-segmentation deeplab

我正在尝试安装Deeplab并在我的计算机上运行它。我正在关注this

我能够运行初始测试'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:

1 个答案:

答案 0 :(得分:0)

首先,创建一个虚拟环境

pip install virtualenv
pip3 install virtualenv

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

sudo mkdir enviornmrnts

进入该目录(cd环境)并激活环境

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