囧境 python import ***, SyntaxError:invalid syntax

pycharm 开发好的程序运行没有问题,但是在terminal上执行却报错😣
断点调试
step1. 查看pycharm编译器路径

pycharm上用的路径/usr/bin/python
step2. Where is python?

于是,通过
whereis和which
来查找python,姨,怎么会指向不同路径?
step3. 诊断问题
一波搜索,大神说的很详细,不再啰嗦参考, 原来是/etc/paths 问题
step3. 修复问题
sudo vim /etc/paths //将/usr/bin和/usr/local/bin颠倒位置

网友评论