[英].bash_profile inoperable, updating path doesn't resolve the issue
I'm not sure where I went wrong, but I used nano
to edit my bash_profile
to install JavaSDK
on my Mac a few days ago. 我不知道我哪里错了,但我用
nano
来编辑我bash_profile
安装JavaSDK
在我的Mac几天前。 I have been doing everything in Eclipse, so I haven't had occasion to visit the command line for a few days...until today. 我一直在Eclipse中进行所有操作,因此几天来我都没有机会访问命令行...直到今天。
Nothing works. 什么都没有。 No
ls
, no nano
, no vim
...nothing. 没有
ls
,没有nano
,没有vim
...什么都没有。 I tried to type: 我试图输入:
-bash: nano: command not found
-bash: ls: command not found
defaults write com.apple.finder.AppleShowAllFiles YES
to unhide system files so I can figure out where my .bash_profile
is and I get this: defaults write com.apple.finder.AppleShowAllFiles YES
即可取消隐藏系统文件,因此我可以弄清楚我的.bash_profile
在哪里,并且得到以下信息:
-bash: defaults: command not found
I'm able to find command line solutions that look promising, but I can't get any commands to be recognized. 我能够找到看起来很有前途的命令行解决方案,但无法识别任何命令。 Any helpful hints would be greatly appreciated.
任何有用的提示将不胜感激。
UPDATE: 更新:
I've attempted to implement solutions I've found on StackOverflow and elsewhere, yet I'm still finding commands that were previously working are no longer doing so. 我试图实现我在StackOverflow和其他地方找到的解决方案,但是我仍然发现以前可以使用的命令不再有效。 When I make changes, I log out and back in. Rebooting doesn't seem to do the trick, either.
进行更改后,我注销并重新登录。重新启动似乎也无济于事。
echo $PATH
returns the following: echo $PATH
返回以下内容:
/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/root/bin:/usr/local/bin /Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin:/usr/local/sbin:/usr/sbin:/usr/ bin:/ root / bin:/ usr / local / bin
Here's my .bash_profile
: 这是我的
.bash_profile
:
#Setting PATH for Python 2.7
export RBENV_ROOT=/usr/local/var/rbenv
#Java setup
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
export PATH=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
# RUBY FIX?
# PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}:/usr/local/sbin:/usr/sbin:/usr/bin:/root/bin:/usr/local/bin"
export PATH
Are there any other places I should be looking? 我还有其他地方要看吗? What turned out to be a minor issue a few days ago is turning into a major one, as I can't get any work done.
几天前变成一个小问题,现在变成一个大问题,因为我无法完成任何工作。
Use /usr/bin/nano
(not just nano
because your PATH
variable is messed up) to edit your .bash_profile
again. 使用
/usr/bin/nano
(不仅是nano
因为您的PATH
变量被弄乱了),再次编辑.bash_profile
。
Remove the line: 删除行:
export PATH=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin
As well as the line: 以及该行:
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}:/usr/local/sbin:/usr/sbin:/usr/bin:/root/bin:/usr/local/bin"
First, save this, log out, log in, and make sure that you have all your commands back as you know them. 首先,保存它,注销,登录,并确保将所有命令恢复为已知状态。
Then check if you have python
and java
available. 然后检查是否有可用的
python
和java
。 You should not need to change the PATH
at all when you have installed Java, and I believe not when you have installed python either. 安装Java时,您根本不需要更改
PATH
,而且我相信安装Python时也不需要。 The installation of the Oracle JDK automatically adds java
to your existing path. Oracle JDK的安装会自动将
java
添加到现有路径。 At most, you should set the JAVA_HOME
. 最多应该设置
JAVA_HOME
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.