简体   繁体   English

.bash_profile无法操作,更新路径无法解决问题

[英].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. 然后检查是否有可用的pythonjava 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.

相关问题 System.getenv 没有得到 ~/.bash_profile 中定义的变量 - System.getenv doesn't get variables defined in ~/.bash_profile 无法在“ / usr / bin / java / bin / java”(-1)中找到可执行文件; bash_profile编辑无法修复 - Unable to locate an executable at “/usr/bin/java/bin/java” (-1); bash_profile edit doesn't fix 登录时 ~/bash_profile 中的 $JAVA_HOME 路径来源不正确 - $JAVA_HOME path not sourced correctly in ~/bash_profile at login 如何在 Mac 上将 Java 路径添加为环境变量 bash_profile - How to add the Java Path as an environment variable bash_profile on Mac 在.bash_profile 中设置 JAVA_HOME 不返回正确的路径 - Setting JAVA_HOME in .bash_profile not returning correct path Linux Redhat .bash_profile不起作用 - Linux Redhat .bash_profile does not work 我想在Mac上安装Java JDK 8,但是.bash_profile无法检测到JAVA_HOME - I want to install Java JDK 8 on mac, but .bash_profile won't detect JAVA_HOME java.io.IOException:没有用于scheme的FileSystem:maprfs。 将maprfs jar添加到bash_profile无效 - java.io.IOException: No FileSystem for scheme: maprfs. Adding the maprfs jar to bash_profile didn't work 如何在.bash_profile中设置JAVA_TOOL_OPTIONS? - How to set JAVA_TOOL_OPTIONS in .bash_profile? Maven无法识别在bash_profile中设置的JAVA_HOME - Maven not recognizing JAVA_HOME being set in bash_profile
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM