Ubuntu 18.04 +python3.6 编译时有语法错误(SyntaxError):
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("hello,world!")
原来是环境里默认的python版本是3.6,而编译Makefile里的引用的是phthon2.x版本的语法;
可以有以下两种方法解决:
1.print 后面的log加括号,如: print hello,world ========>print("hello,world!")
2.降级python版本到2.x:
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python2.7 python
然后确认下是不是指信python2.7
sudo ls -la /usr/bin/python*
lrwxrwxrwx 1 root root 9 Nov 25 02:11 /usr/bin/python -> python2.7
lrwxrwxrwx 1 root root 9 Apr 16 2018 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 3628976 Sep 30 06:38 /usr/bin/python2.7
lrwxrwxrwx 1 root root 9 Jul 8 22:49 /usr/bin/python3 -> python3.6
-rwxr-xr-x 2 root root 4526456 Oct 8 05:12 /usr/bin/python3.6
-rwxr-xr-x 2 root root 4526456 Oct 8 05:12 /usr/bin/python3.6m
lrwxrwxrwx 1 root root 10 Jul 8 22:49 /usr/bin/python3m -> python3.6m
lrwxrwxrwx 1 root root 58 Mar 5 2018 /usr/bin/pythontex -> ../share/texlive/texmf-dist/scripts/pythontex/pythontex.py
-rwxr-xr-x 1 root root 306 Mar 5 2018 /usr/bin/pythontex3
然后执行shell时正常了。