linux环境下python中import找不到自定义模块
linux环境下python中import找不到自定义模块
解决方法:修改环境变量/etc/profile
打开/etc/profile
vim /etc/profile
在/etc/profile的最后一行添加
export PYTHONPATH=$PYTHONPATH:/home/mycode/
/home/mycode/ 为添加库的路径
生效:退出后输入以下命令
source /etc/profile
OK!即刻生效,所有文件都可以import /home/mycode/下的模块了!
原创
2022-01-10 10:24:53 ·
836 阅读 ·
0 评论