首页 > 解决方案 > 在 mac 终端中执行命令时出现奇怪的语法错误

问题描述

每次我尝试执行某些命令(例如 'pyenv 版本' 或通过执行命令 'code .' 打开 vs 代码)时,这两个命令都会导致相同的奇怪错误:

Syntax Warning: May not be a PDF file (continuing anyway)
Syntax Error: Couldn't read xref table
Syntax Warning: PDF file is damaged - attempting to reconstruct xref table...
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't read xref table

为什么这些命令完全被解释为 pdf 文件?这是其中一个命令运行的屏幕截图:

这是其中一次运行的屏幕截图:

此外,当我从 .bash_profile 中删除以下内容时,“pdftotext 3.04 版”和其他行将从终端中消失:

if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi

因此,从 .bash_profile 中删除上述行后,终端如下所示:

新航站楼

另外,当我运行命令'set -x; 代码 。',我得到以下信息:

Last login: Wed Jul 31 15:10:24 on ttys001
martand ~ $ set -x; code . 
+ code .
Syntax Warning: May not be a PDF file (continuing anyway)
Syntax Error: Couldn't read xref table
Syntax Warning: PDF file is damaged - attempting to reconstruct xref table...
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't read xref table
++ update_terminal_cwd
++ local url_path=
++ local i ch hexch LC_CTYPE=C LC_ALL=
++ (( i = 0 ))
++ (( i < 14 ))
++ ch=/
++ [[ / =~ [/._~A-Za-z0-9-] ]]
++ url_path+=/
++ (( ++i ))
++ (( i < 14 ))
++ ch=U
++ [[ U =~ [/._~A-Za-z0-9-] ]]
++ url_path+=U
++ (( ++i ))
++ (( i < 14 ))
....
++ return 1

标签: pythonmacoscommand-lineterminalvisual-studio-code

解决方案


推荐阅读