tflearn导入错误:“导入错误:没有名为contrib.framework.python.ops的模块”

时间:2020-01-21 08:44:17

标签: python-2.7 tflearn

为了提供一些背景信息,我正在尝试对该Github存储库进行培训:https://github.com/nywang16/Pixel2Mesh(!python train.py)

我正在将Google Colab与Python2和GPU结合使用(在“运行”设置中)

在调试过程中,借助对与回购相关的问题的评论(例如https://github.com/nywang16/Pixel2Mesh/issues/39),我已经修改了makefile并安装了Tensorflow的GPU版本(!pip install tensorflow-gpu == 1.3)

但是现在我遇到了以下错误,我不知道该如何解决! (已经安装了tflearn)

```
Traceback (most recent call last):
  File "train.py", line 19, in <module>
    from p2m.models import GCN
  File "/content/gdrive/My Drive/MVA/RecVis/Project/Pixel2Mesh-master/p2m/models.py", line 18, in <module>
    import tflearn
  File "/usr/local/lib/python2.7/dist-packages/tflearn/__init__.py", line 4, in <module>
    from . import config
  File "/usr/local/lib/python2.7/dist-packages/tflearn/config.py", line 5, in <module>
    from .variables import variable
  File "/usr/local/lib/python2.7/dist-packages/tflearn/variables.py", line 7, in <module>
    from tensorflow.contrib.framework.python.ops import add_arg_scope as contrib_add_arg_scope
ImportError: No module named contrib.framework.python.ops
```

这是我修改后的makefile:

```
nvcc= /usr/local/cuda-10.0/bin/nvcc
cudalib = /usr/local/cuda-10.0/lib64
tensorflow=/usr/local/lib/python2.7/dist-packages/tensorflow_core/include

TF_LIB=/usr/local/lib/python2.7/dist-packages/tensorflow_core

all: tf_approxmatch_so.so tf_approxmatch_g.cu.o tf_nndistance_so.so tf_nndistance_g.cu.o


tf_approxmatch_so.so: tf_approxmatch_g.cu.o tf_approxmatch.cpp
    g++ -std=c++11 tf_approxmatch.cpp tf_approxmatch_g.cu.o -o tf_approxmatch_so.so -shared -fPIC -L$(TF_LIB) -l:libtensorflow_framework.so.1 -I $(tensorflow) -lcudart -L $(cudalib) -O2 -D_GLIBCXX_USE_CXX11_ABI=0


tf_approxmatch_g.cu.o: tf_approxmatch_g.cu
    $(nvcc) -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 -c -o tf_approxmatch_g.cu.o tf_approxmatch_g.cu -L$(TF_LIB) -l:libtensorflow_framework.so.1 -I $(tensorflow) -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -O2


tf_nndistance_so.so: tf_nndistance_g.cu.o tf_nndistance.cpp
    g++ -std=c++11 tf_nndistance.cpp tf_nndistance_g.cu.o -o tf_nndistance_so.so -shared -fPIC -L$(TF_LIB) -l:libtensorflow_framework.so.1 -I $(tensorflow) -lcudart -L $(cudalib) -O2 -D_GLIBCXX_USE_CXX11_ABI=0

tf_nndistance_g.cu.o: tf_nndistance_g.cu
    $(nvcc) -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 -c -o tf_nndistance_g.cu.o tf_nndistance_g.cu -L$(TF_LIB) -l:libtensorflow_framework.so.1 -I $(tensorflow) -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -O2


clean:
    rm tf_approxmatch_so.so
    rm tf_nndistance_so.so
    rm  *.cu.o
```

非常感谢您的帮助!

0 个答案:

没有答案