python - ModuleNotFoundError : No module named 'tf_slim'

标签 python python-3.x tensorflow anaconda deeplab

使用 Anaconda 尝试设置 deeplab (https://github.com/tensorflow/models/tree/master/research/deeplab)。
通过看到其他问题得到解答,我已经解决了很多问题,但遇到了一个似乎没有得到解答的问题:
当尝试运行“python deeplab/model_test.py”时,我得到:

(base) PS D:\DeepLab\models-master\research> python deeplab/model_test.py
C:\Users\Jake\anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Jake\anaconda3\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
Traceback (most recent call last):
  File "deeplab/model_test.py", line 22, in <module>
    from deeplab import model
  File "D:\DeepLab\models-master\research\deeplab\model.py", line 58, in <module>
    from deeplab.core import feature_extractor
  File "D:\DeepLab\models-master\research\deeplab\core\feature_extractor.py", line 24, in <module>
    from deeplab.core import nas_network
  File "D:\DeepLab\models-master\research\deeplab\core\nas_network.py", line 44, in <module>
    from deeplab.core import nas_genotypes
  File "D:\DeepLab\models-master\research\deeplab\core\nas_genotypes.py", line 23, in <module>
    from deeplab.core import nas_cell
  File "D:\DeepLab\models-master\research\deeplab\core\nas_cell.py", line 29, in <module>
    from deeplab.core import xception as xception_utils
  File "D:\DeepLab\models-master\research\deeplab\core\xception.py", line 58, in <module>
    from nets.mobilenet import conv_blocks as mobilenet_v3_ops

  **File "D:\DeepLab\models-master\research\slim\nets\mobilenet\conv_blocks.py", line 20, in <module>
    import tf_slim as slim
ModuleNotFoundError: No module named 'tf_slim'**
我发现了一些建议,这可能与环境变量有关,但我的都是正确的:env vars
我多次刷新 anaconda 窗口以确保更改正在发生。
我的文件夹目录中有 tf_slim:C:\Program Files\Python36\Lib\site-packages\tf_slim。
不知道该怎么做:(我对这种类型的安装很陌生。
我在 Windows 10 上。

最佳答案

Anaconda 默认创建一个虚拟环境,如果你通过 anaconda 提示符打开 python,虚拟环境中的 python 可执行文件就会打开。
该虚拟环境将拥有自己的一组模块,并且不会引用系统级 python 包。
我建议你打开 anaconda 提示符并输入以下命令:
点安装 tf_slim

关于python - ModuleNotFoundError : No module named 'tf_slim' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62483953/

相关文章:

python - 以编程方式在 plone 上创建内容类型时,time.time() 是一种安全的方法吗?

python - anaconda 无法导入 matplotlib.pyplot

python - 我应该如何序列化 dateutil.tz.tzlocal 对象?

python - 使用 opencv2 在 python 中编写流式视频

python - 打印元组中的元素

python - CuDNNLSTM(而不是 LSTM)层的意外结果

python - Django 中 clean 和 full_clean 函数的主要区别是什么?

python-3.x - Google Analytics API 服务对象 - 无管理属性

python - TF.Learn DNNClassifier 和 LinearClassifier 的准确性问题

python - model.fit() 不接受 tf.data.Dataset 的输入形状