如何在Linux中设置Ruby环境? [英] How to set Ruby Environment in Linux?
问题描述
~$ ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
注意:我不想使用 RVM
推荐答案
您是如何安装红宝石的?apt-get install?我强烈建议使用RVM,它将使您的生活更轻松.但总的来说,您可以通过标准方式在Linux中设置环境变量:
How did you install your ruby? apt-get install ? I highly recommend using RVM it will make your life easier. But in General you can set up your Environment variables in Linux in a standard way:
显示当前环境:
set
您可以使用export命令修改每个环境或系统变量.设置PATH环境变量,使其包含安装了perl和shell脚本的bin目录的目录:
You can modify each environmental or system variable using the export command. Set the PATH environment variable to include the directory where you installed the bin directory with perl and shell scripts:
export PATH=${PATH}:/home/username/bin
OR
export PATH=${PATH}:${HOME}/bin
您将需要使用
which ruby
然后进行设置:
export PATH=${PATH}:/Users/info/.rvm/rubies/ruby-2.0.0-p353/bin
使用控制台登录或使用ssh远程登录时,将执行〜/.bash_profile($ HOME/.bash_profile)或〜/.prfile文件.将路径添加到〜/.bash_profile文件
The ~/.bash_profile ($HOME/.bash_profile) or ~/.prfile file is executed when you login using console or remotely using ssh. Add the path to ~/.bash_profile file
这篇关于如何在Linux中设置Ruby环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!