python:Inverterror:没有名为Src.Results的模块
我的教授提供了一个工作代码。我被要求只是学会使用它。 我正在远程ubuntu
在Uni上运行它,带有python 2.7
,我的教授使用的同一服务器对他有用。 不幸的是,启动.py
文件时,我会收到以下错误:
$ python bks-cascade.py
Traceback (most recent call last):
File "bks-cascade.py", line 5, in <module>
from src.results import *
ImportError: No module named src.results
这是前5行:
import os
import numpy as np
import argparse
from src.results import * # here it fails
我搜索并发现我必须将其添加到我的SYS路径中,所以我做到了
export PYTHONPATH="${PYTHONPATH}:src"
: 导出pythonpath =“ $ {pythonpath}:src/结果” 然后:
python -c "import sys; print('\n'.join(sys.path))"
/home/bojanpoletan/Proj
/home/bojanpoletan/Proj/src/results
/home/bojanpoletan/Proj/src
/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/dist-packages
/usr/local/lib/python2.7/dist-packages/pycuda-2015.1.2-py2.7-linux-x86_64.egg
/usr/local/lib/python2.7/dist-packages/pytest-2.7.2-py2.7.egg
/usr/local/lib/python2.7/dist-packages/pytools-2015.1.2-py2.7.egg
/usr/local/lib/python2.7/dist-packages/py-1.4.30-py2.7.egg
/usr/local/lib/python2.7/dist-packages/dlib-19.6.0-py2.7-linux-x86_64.egg
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PILcompat
/usr/lib/python2.7/dist-packages/gtk-2.0
然后我再次尝试运行该程序,但仍然没有。 附件您可以看到我的项目文件夹的层次结构。
有什么想法?谢谢!
I have a working code given by my prof. I am asked just to learn to use it.
I am runing it on a remote Ubuntu
machine, at uni, with python 2.7
, the same server my prof uses and says it works for him.
Unfortunately when starting the .py
file I get the following error:
$ python bks-cascade.py
Traceback (most recent call last):
File "bks-cascade.py", line 5, in <module>
from src.results import *
ImportError: No module named src.results
Here are the first 5 lines:
import os
import numpy as np
import argparse
from src.results import * # here it fails
So I googled and discovered I have to add that to my sys path and so i did:
export PYTHONPATH="${PYTHONPATH}:src"
and also
export PYTHONPATH="${PYTHONPATH}:src/results"
and then:
python -c "import sys; print('\n'.join(sys.path))"
/home/bojanpoletan/Proj
/home/bojanpoletan/Proj/src/results
/home/bojanpoletan/Proj/src
/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/dist-packages
/usr/local/lib/python2.7/dist-packages/pycuda-2015.1.2-py2.7-linux-x86_64.egg
/usr/local/lib/python2.7/dist-packages/pytest-2.7.2-py2.7.egg
/usr/local/lib/python2.7/dist-packages/pytools-2015.1.2-py2.7.egg
/usr/local/lib/python2.7/dist-packages/py-1.4.30-py2.7.egg
/usr/local/lib/python2.7/dist-packages/dlib-19.6.0-py2.7-linux-x86_64.egg
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PILcompat
/usr/lib/python2.7/dist-packages/gtk-2.0
then I tried again to run the program but still nothing.
Attached you can see the hierarchyof my project folder.
Hierarchy of my project
Any idea ? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论