ModuleNotFoundError:没有名为“mononphm”的模块

问题描述 投票:0回答:1

我已按照此处的说明进行操作:

https://github.com/SimonGiebenhain/MonoNPHM?tab=readme-ov-file#31-demo

通过以下方式运行模型:

python scripts/inference/rec.py --model_type nphm --exp_name pretrained_mononphm --ckpt 2500 --seq_name 00898 --no-intrinsics_provided --downsample_factor 0.33

我收到此错误:

回溯(最近一次调用最后一次):

文件“/home/arisa/MonoNPHM/scripts/inference/rec.py”,第 7 行,位于

从mononphm.photometric_tracking.tracking导入轨迹

ModuleNotFoundError:没有名为“mononphm”的模块

通过

from mononphm
导入时出现错误:

import json, os, yaml
import torch
import numpy as np
import tyro
from typing import Literal

from mononphm.photometric_tracking.tracking import track
from mononphm.photometric_tracking.wrapper import WrapMonoNPHM
from mononphm.models.neural3dmm import nn3dmm
from mononphm.models import setup_training
from mononphm import env_paths
from mononphm.utils.others import EasyDict

我在这里尝试了一些解决方案:相对导入 - ModuleNotFoundError:没有名为 x 的模块

但是到目前为止,我尝试过的解决方案都不起作用。

看起来其他人没有收到我的错误,他们超越并收到其他错误:https://github.com/SimonGiebenhain/MonoNPHM/issues/7#issuecomment-2220001296

有人可以帮忙吗?

python python-3.x package python-import relative-import
1个回答
0
投票

康达环境

不使用环境 PIP

我已经通过以下方式激活了 Conda 环境:

conda activate mononphm

但是Conda环境的PIP没有被使用:

 which pip
/home/arisa/.local/bin/pip

解决方案

Conda env 的 PIP 和 Python 的 Abs 路径

终于解决了错误。

我通过使用 Conda 环境的绝对路径显式调用 PIP:

sudo /home/arisa/.conda/envs/mononphm/bin/pip3 install -e .

然后通过Conda环境的绝对路径调用Python:

/home/arisa/.conda/envs/mononphm/bin/python3.9 scripts/inference/rec.py --model_type nphm --exp_name pretrained_mononphm --ckpt 2500 --seq_name 00898 --no-intrinsics_provided --downsample_factor 0.33

错误现已解决。我正在做下一个故障排除。

© www.soinside.com 2019 - 2024. All rights reserved.