简体   繁体   English

安装 Leiningen 以与 Clojure 一起使用

[英]Installing Leiningen for use with Clojure

I'm trying to install Leiningen on my local machine to get Clojure running, but I can't seem to get the latest version.我正在尝试在我的本地机器上安装 Leiningen 以使 Clojure 运行,但我似乎无法获得最新版本。

I'm following the instructions on github here: https://github.com/technomancy/leiningen我正在按照 github 上的说明进行操作: https : //github.com/technomancy/leiningen

I'm able to put the script in my path, and get Lein to download, but for some reason when I run lein version I keep getting我可以将脚本放在我的路径中,并让 Lein 下载,但是由于某种原因,当我运行lein version我不断收到

Leiningen 1.7.1 on Java 1.6.0_33 Java HotSpot(TM) 64-Bit Server VM

I've tried deleting and re-installing Leiningen several times, but nothing changes.我曾多次尝试删除并重新安装 Leiningen,但没有任何变化。 Are there certain files I need to be deleting, or is there some way to switch versions?我是否需要删除某些文件,或者有什么方法可以切换版本? lein upgrade doesn't seem to do anything. lein upgrade似乎没有任何作用。

Thanks in advance.提前致谢。

An easier way of upgrading (if using homebrew) is to upgrade using homebrew and specify the version. 更简单的升级方法(如果使用自制程序)是使用自制程序升级并指定版本。

  1. Show available versions 显示可用版本

      brew info leiningen leiningen: stable 1.7.1, devel 2.0.0-preview10, HEAD 
  2. Install or upgrade to a specific version 安装或升级到特定版本

     brew upgrade --devel leiningen ... /usr/local/Cellar/leiningen/2.0.0-preview10: 5 files, 80K, built in 10 seconds 
  3. Use lein as normal 正常使用lein

     lein version Leiningen 2.0.0-preview10 on Java 1.7.0_06 Java HotSpot(TM) 64-Bit Server VM 

Check this guide: https://github.com/technomancy/leiningen/wiki/Upgrading 请查看本指南: https//github.com/technomancy/leiningen/wiki/Upgrading

The trick is to download the script from the preview branch on the github repo: 诀窍是从github repo上的预览分支下载脚本:

# Make a backup of your previous lein
mv ~/bin/lein ~/bin/lein1
# Download preview version
wget -O ~/bin/lein https://raw.github.com/technomancy/leiningen/preview/bin/lein
# set permissions
chmod 755 ~/bin/lein

I found the issue. 我发现了这个问题。 I had previously tried to install Leiningen via Homebrew, and the Homebrew lein command was somehow superseding the lein commands from the new version I had installed through the script. 我之前曾尝试通过Homebrew安装Leiningen,Homebrew lein命令以某种方式取代了我通过脚本安装的新版本的lein命令。

I ran the command: 我跑了命令:

brew uninstall leiningen

Then I re-installed lein via the new lein script just be safe, first removing the following files & folders: 然后我通过新的lein脚本重新安装lein只是安全,首先删除以下文件和文件夹:

~/.lein
~/.m2
~/bin/lein

Now when I run lein version I get: 现在,当我运行lein version我得到:

Leiningen 2.0.0-preview10 on Java 1.6.0_33 Java HotSpot(TM) 64-Bit Server VM

There's constant LEIN_VERSION at the top of the lein script. 有恒定的LEIN_VERSION在顶部lein脚本。 Try changing it a more recent version (mine is 2.0.0-preview10 ), delete the leiningen jar in ~/.lein/self-installs/ and run lein self-install again. 尝试将其更改为更新的版本(我的是2.0.0-preview10 ),删除~/.lein/self-installs/的leiningen jar并再次运行lein self-install

To completely wipe out your existing Leiningen installation: 要完全消除现有的Leiningen安装:

rm ~/bin/lein
rm -fr ~/.lein  # Though back up ~/.lein/profiles.clj if you have one.
rm -fr ~/.m2

then follow the "If you want a newer version it's still easy to install the old-fashioned way" instructions at http://leiningen.org/ . 然后按照http://leiningen.org/上的“如果你想要一个更新的版本,仍然很容易安装旧式的方式”说明。

Incidentally, if you happen to have a ~/bin/lein2 lying around, and have no need of any legacy lein 1.x (which, in your case, you don't), you can delete that ~/bin/lein2 file. 顺便说一句,如果你碰巧有一个〜/ bin / lein2,并且不需要任何遗留lein 1.x(在你的情况下,你没有),你可以删除〜/ bin / lein2文件。 You just want a ~/bin/lein going forward. 你只想要一个〜/ bin / lein继续前进。

had the same issue make sure you update brew 有同样的问题,请确保您更新brew

$brew update

then 然后

$brew install leiningen --devel

For anyone wondering how to install a specific version of lein, an "easy" way to do so is by looking for the commit of the desired version on the install script https://github.com/technomancy/leiningen/blob/master/bin/lein对于想知道如何安装特定版本的 lein 的人来说,一个“简单”的方法是在安装脚本https://github.com/technomancy/leiningen/blob/master/上查找所需版本的提交 宾/莱因

Download and run this script as your lein binary and it should just work.下载并运行此脚本作为您的lein二进制文件,它应该可以正常工作。 The actual version jar will be downloaded to ~/.lein/self-installs实际版本jar会下载到~/.lein/self-installs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM