python:Inverterror:没有名为Src.Results的模块

发布于 2025-02-06 19:43:46 字数 1586 浏览 0 评论 0原文

我的教授提供了一个工作代码。我被要求只是学会使用它。 我正在远程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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文