【发布时间】:2018-12-20 08:57:44
【问题描述】:
我的文件结构类似于
/home/ec2-user/wep-rs/WEPR/weprs/api/voucher.py
/home/ec2-user/wep-rs/WEPR/weprs/api/scrappers/quotes/quotes.py
i want to access voucher.py from quotes.py
这些我都试过了
import sys
sys.path.append("..")# ValueError: attempted relative import beyond top-level package
from .. .. import api # ValueError: attempted relative import beyond top-level package
sys.path.append("/home/ec2-user/wep-rs/WEPR/weprs/api/")
from api.voucher import Voucher
error i am getting is
ModuleNotFoundError: No module named 'api'
【问题讨论】:
-
sys.path.append("/home/ec2-user/wep-rs/WEPR/weprs")也许? -
不工作相同的错误 no module named api, sys.path.append("/home/ec2-user/wep-rs/WEPR/weprs") 从 api 导入凭证
标签: python django python-3.x python-2.7