安裝NW後發現nwjs命令還用不了,沒這個命令:
解決辦法:
* 臨時添加環境變量
直接在終端中輸入export PATH=該命令所在文件路徑 ,只要不退出這個終端就能臨時使用該命令:
export PATH=/Applications/nwjs.app/Contents/MacOS
* 配置環境變量的正確姿勢
打開終端,依次輸入:
cd ~/
touch .bash_profile
open .bash_profile
這樣就會通過記事本打開.bash_profile,裏面有我之前配置過的Python環境變量,繼續添加(注意:${PATH}):
export PATH="/Applications/nwjs.app/Contents/MacOS:${PATH}"
然後command+s保存文件,關閉記事本後在終端輸入:
source .bash_profile
大功告成,重啓終端就可以繼續使用新添加的命令: