ruby 如何将 usr/local/bin 添加到 ubuntu 12.0.4 上的路径环境变量?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15050443/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to add usr/local/bin to path environment variable on ubuntu 12.0.4?
提问by Omer Raja
I have just installed ruby.1.8.6 on Ubuntu 12.0.4.
我刚刚在 Ubuntu 12.0.4 上安装了 ruby.1.8.6。
I am learning ruby out of a book and after the installation process it says
我正在从一本书中学习 ruby,并且在安装过程之后它说
"Once it's completed, you should add /usr/local/bin to your PATH environment variable. I'll assume that, being a Linux user"
“完成后,您应该将 /usr/local/bin 添加到您的 PATH 环境变量中。我假设是 Linux 用户”
And I'm stuck as the guy has a wrong assumption.
我被困住了,因为这个人有一个错误的假设。
How do I add usr/local/bin to the path environment variable?
如何将 usr/local/bin 添加到路径环境变量中?
回答by alestanis
You can add this to your ~/.bashrcfile:
您可以将其添加到您的~/.bashrc文件中:
PATH=$PATH:/usr/local/bin
If you don't know how, you can just execute this line in a Terminal:
如果你不知道怎么做,你可以在终端中执行这一行:
echo "PATH=$PATH:/usr/local/bin" >> ~/.bashrc
You can also check what's in your PATHby typing in the Terminal
您还可以PATH通过在终端中输入来检查您的内容
echo $PATH
回答by Ian McMahon
for the current terminal session, you can:
对于当前终端会话,您可以:
export PATH=$PATH:/usr/local/bin
For a more permanent solution, edit ~/.bashrcand add the line above
要获得更持久的解决方案,请编辑~/.bashrc并添加上面的行

