运行 deeplab 代码时运行命令时出现'No Module named Tensorflow'错误'sh local_test.sh'



我正在尝试安装 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:

首先,创建一个虚拟环境

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
****

**

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

相关内容

  • 没有找到相关文章

最新更新