问题描述
我目前正在尝试在Windows 7上安装tensorflow对象检测应用程序(对雇主的要求),但从最后开始的几步失败.
I am currently attempting to install the tensorflow object detection app on Windows 7 (employer requirement) and I am failing at a few steps from the end.
基本上,运行安装测试命令时出现以下错误:ImportError:没有名为nets的模块.
Basically I get the following error when I run the installation test command:ImportError: No module named nets.
我已经阅读了有关该主题的一些解决方案:
I have read some solutions on the subject:
https://github.com/tensorflow/models/issues/729 https://github.com/tensorflow/models/issues/1842
如下所示:export PYTHONPATH ="$ PYTHONPATH:" somepath"/tensorflow/models/slim"
which looks like this:export PYTHONPATH="$PYTHONPATH:"somepath"/tensorflow/models/slim"
基本上意味着我必须在PYTHONPATH环境变量中设置正确的路径.
basically meaning that I must set the right path in the PYTHONPATH environmental variable.
在Windows操作系统下,我尝试调用此命令:SET PYTHONPATH ="$ PYTHONPATH:C:tensorflow/models/slim当它不起作用时,我在system->环境变量中创建了PYTHONPATH变量.
Working with Windows, I tried calling this:SET PYTHONPATH="$PYTHONPATH:C:tensorflow/models/slimAnd when it didn't work, I created a PYTHONPATH variable in system-> environmental variables.
我仍然遇到错误,所以我想我仍然缺少一些东西,但是由于我缺乏知识,我仍然不知道是什么.
I'm still getting the error so I suppose that I am still missing something but due to my lack of knowledge I still can't figure out what.
熟悉Windows的人能够指出缺少的内容吗?
Would someone familiar with Windows be able to point out what's missing?
谢谢
推荐答案
我想出了一种使其工作的方法.我并不是将其写成最终答案,因为它主要是一种解决方法,并且由于缺乏我的理解,我不能保证它会起作用(而且这可能不是最佳实践).
I figured out a way to make it work. I am not writing this as a final answer as it is mostly a workaround and due to lack of understanding from my part I cannot guarantee it will work (and also it might not be best good practice).
无论如何这里是
正如Beta之前所建议的那样,您必须运行setup.py,但是对我而言,它不是从models文件夹运行的,我还必须是从object detection文件夹运行的.
As Beta previously suggested, you have to run setup.py, however running it from models folder did not do it for me, I also had to run it from object detection folder.
但是那里有一个问题,它产生了一个错误,说BUILD已经存在(这是正确的),所以我不得不从模型内部删除BUILD文件.
However there was a problem there, it generated an error saying the BUILD already existed (which was correct) so I had to delete the BUILD file from inside of model.
在此之后,发现我设置的路径工作正常.
After that it worked, turns out the path I had set was working fine.
现在,如果某些专家对此进行调查,并说明此变通办法的工作方式和原因,那么它可能会使它成为有效的解决方案.
Now if some experts would look into this and explain how and why this workaround worked it might make this a valid solution.
这篇关于Tensorflow对象检测:ImportError:没有名为nets的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!