将RVM与virtualenv一起使用时,“警告!PATH未正确设置”

时间:2014-07-20 22:59:48

标签: ruby rvm virtualenv

我收到此错误:

Warning! PATH is not properly set up, '/home/oscar/.rvm/gems/ruby-2.1.2/bin' is not at first place,
     usually this is caused by shell initialization files - check them for 'PATH=...' entries,
     it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
     to fix temporarily in this shell session run: 'rvm use ruby-2.1.2'.
rvm 1.25.28 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

当我进入任何virtualenv。它首先需要virtualenv的道路。在这个例子中,我调用了virtualenv borrar ,所以这是我的路径:

/home/oscar/projects/borrar/bin:/home/oscar/.rvm/gems/ruby-2.1.2/bin:/home/oscar/.rvm/gems/ruby-2.1.2@global/bin:/home/oscar/.rvm/rubies/ruby-2.1.2/bin:/home/oscar/eagle-6.6.0/bin:/home/oscar/android-studio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/oscar/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-7-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin

我在任何虚拟世界之外的路径是我认为是正确的,因为 rvm位于第一位。:

/home/oscar/.rvm/gems/ruby-2.1.2/bin:/home/oscar/.rvm/gems/ruby-2.1.2@global/bin:/home/oscar/.rvm/rubies/ruby-2.1.2/bin:/home/oscar/eagle-6.6.0/bin:/home/oscar/android-studio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-7-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/oscar/.rvm/bin

这是我的.zshrc 在这里我的.zsh_profile我最后加载了RVM。

感谢您的帮助。

1 个答案:

答案 0 :(得分:7)

RVM路径不匹配

RVM抱怨,因为它想要在你的PATH中第一个。它不是;你已经预先设置了其他东西,或者你的virtualenv包装器。在这种情况下,您可以使用. ~/.rvm/scripts/rvm从virtualenv内部重新调用RVM设置脚本,或者您可以故意使错误无效,如下所述。

RVM文档强烈建议您在shell资源文件中调用最后一个RVM设置脚本,以便(除其他外)RVM可以确保它优先于PATH中可能存在的其他Rubies或包装器。但是,如果您确定您知道自己在做什么并且不会遇到任何与PATH相关的意外,您可以通过添加这个鲜为人知的配置选项来关闭此警告你的.rvmrc文件:

echo 'rvm_silence_path_mismatch_check_flag=1' >> ~/.rvmrc