Jupyter Notebook: 解决'SyntaxError: invalid syntax' 错误
在 Jupyter Notebook 中,你可能会遇到 'SyntaxError: invalid syntax' 错误,这通常是因为在路径字符串中缺少一个引号。例如,在 Cell In[35] 中的第 2 行代码:
sys.path.append(F:\python3\anaconda3\python.exe')
出现错误的原因是 F:\python3\anaconda3\python.exe' 中的路径字符串缺少一个引号。正确的写法应该是:
sys.path.append('F:\python3\anaconda3\python.exe')
确保路径字符串中的引号完整,就可以解决该错误。
原文地址: https://www.cveoy.top/t/topic/jN7d 著作权归作者所有。请勿转载和采集!