gpt4 book ai didi

python - 导入错误: No module named - python anaconda

转载 作者:行者123 更新时间:2023-12-01 04:25:35 25 4
gpt4 key购买 nike

我只想运行那里给出的代码:https://github.com/skaae/lasagne-draw

这是下载后lasagne-draw-master文件的目录结构:

lasagne-draw-master\

-->\deepmodels
--> __init__.py, batchiterator.py, confusionmatrix.py
-->\layers
--> __init__.py, draw.py, draw_helpers.py, draw_helpers_test.py

-->\examples
--> mnist_draw.py, helper_functions.py

对于安装,我必须在安装 Theano 和 Lasagne 后执行这些步骤,如自述文件中所述。我也在 lasagne-draw-master 目录中。

python setup.py develop

cd ..

python -c 'import deepmodels'

以上两条命令完美执行。但是当我执行第三个命令时,它显示了这个错误:

File "<string>", line 1, in <module>
File "deepmodels\__init__.py", line 2, in <module>
from . import layers
File "deepmodels\layers\__init__.py", line 1, in <module>
from .base import *
ImportError: No module named base

deepmodels__init__.py的内容是:

from . import confusionmatrix
from . import layers
from . import batchiterator

deepmodels\layers__init__.py 的内容为:

from .base import *
from .draw import *

我正在使用 python anaconda。 init.py 文件或其他文件中是否存在语法错误?

最佳答案

我刚刚解决了问题,并通过修改 init.py 和 draw.py(在图层目录中)文件解决了这些问题。

deepmodels/init.py

change followings

from . import confusionmatrix
from . import layers
from . import batchiterator

to follows;

import confusionmatrix
import layers
import batchiterator

deepmodels/layers/init.py

change followings

from .base import *
from .draw import *

to as follows;

from lasagne.layers.base import *
from draw import *

deepmodels/layers/draw.py

line 8
comment out from .. import logdists

关于python - 导入错误: No module named - python anaconda,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33197796/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com