Valuebai / awesome-python-io

Python十分钟入门指南/技术图谱,持续更新收集整理中,期待你的参与
MIT License
8 stars 1 forks source link

【部署报错】在pycharm执行正常,在命令行窗口报错No module named 'base' #11

Open Valuebai opened 4 years ago

Valuebai commented 4 years ago

解决方案:在run_test.py文件最前面加上以下代码,必须放在所有improt之前!!!!!

import sys import os curPath = os.path.abspath(os.path.dirname(file)) rootPath = os.path.split(curPath)[0] sys.path.append(rootPath)

Valuebai commented 4 years ago

或者 import sys sys.path.append('..') 在from xxx import之前加上这句