我将python bin文件夹添加到环境变量中PATH,
export PATH=$PATH:/Library/Frameworks/Python.framework/Versions/2.7/bin
Run Code Online (Sandbox Code Playgroud)
但以下语句失败
set: Warning: path component /usr/local/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /Library/Frameworks/Python.framework/Versions/2.7/bin'?
set: Warning: path component /usr/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /Library/Frameworks/Python.framework/Versions/2.7/bin'?
set: Warning: path component /bin:/Library/Frameworks/Python.framework/Versions/2.7/bin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /Library/Frameworks/Python.framework/Versions/2.7/bin'?
set: Warning: path component /usr/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin may not be valid in PATH.
set: No such file or directory
set: Did you mean 'set PATH $PATH /Library/Frameworks/Python.framework/Versions/2.7/bin'?
set: Warning: path component /sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin may not be valid in PATH.
set: No such file or directory...
Run Code Online (Sandbox Code Playgroud)
发生了什么?我和其他许多人一样(Google搜索)。所用的贝壳是鱼。
您正在使用bash(或ksh)语法,该语法在fish中不起作用。
fish文档涵盖了在此处设置PATH的方法:http://fishshell.com/docs/current/tutorial.html#tut_path
您想要的语法是:
set PATH $PATH /Library/Frameworks/Python.framework/Versions/2.7/bin
Run Code Online (Sandbox Code Playgroud)