python模型路径导入的时候出错的解决办法

1.采用搜索路径

python 复制代码
import sys

sys.path.append('Transformer/')

2.在要导入的包下面添加初始化py文件

新建一个init.py文件在所在文件夹下面

相关推荐
明月_清风35 分钟前
从“能用”到“专业”:构建生产级装饰器与三层逻辑拆解
后端·python
曲幽10 小时前
数据库实战:FastAPI + SQLAlchemy 2.0 + Alembic 从零搭建,踩坑实录
python·fastapi·web·sqlalchemy·db·asyncio·alembic
用户83562907805115 小时前
Python 实现 PowerPoint 形状动画设置
后端·python
ponponon16 小时前
时代的眼泪,nameko 和 eventlet 停止维护后的项目自救,升级和替代之路
python
Flittly16 小时前
【从零手写 ClaudeCode:learn-claude-code 项目实战笔记】(5)Skills (技能加载)
python·agent
敏编程16 小时前
一天一个Python库:pyarrow - 大规模数据处理的利器
python
Flittly18 小时前
【从零手写 ClaudeCode:learn-claude-code 项目实战笔记】(4)Subagents (子智能体)
python·agent
明月_清风1 天前
Python 装饰器前传:如果不懂“闭包”,你只是在复刻代码
后端·python
明月_清风1 天前
打破“死亡环联”:深挖 Python 分代回收与垃圾回收(GC)机制
后端·python
ZhengEnCi2 天前
08c. 检索算法与策略-混合检索
后端·python·算法