尝试使用命令行执行自己的一个小项目,抛出了异常
(venv) [root@node2 hui-cache-test]# python system-info-data/src/main.py
Traceback (most recent call last):
File "system-info-data/src/main.py", line 1, in <module>
from src.iostat.collect_op import *
ModuleNotFoundError: No module named 'src'
Google一番原来是需要配置$PYTHONPATH
export PYTHONPATH=path-to-project-directory:$PYTHONPATH
#export PYTHONPATH=/root/hui-cache-test/system-info-data:$PYTHONPATH