【发布时间】:2013-11-21 03:18:52
【问题描述】:
我正在尝试根据 this answer 使用 expt 函数,但是当我尝试在 REPL 中执行 (use 'clojure.math.numeric-tower) 时出现错误
user> (use 'clojure.math.numeric-tower)
(use 'clojure.math.numeric-tower)FileNotFoundException Could not locate clojure/math/numeric_tower__init.class or clojure/math/numeric_tower.clj on classpath: clojure.lang.RT.load (RT.java:443)
我认为我需要按照 here 的说明输入 Leiningen 依赖信息
[org.clojure/math.numeric-tower "0.0.2"]
在我的project.clj 中,我这样做了,但我仍然遇到同样的错误。我做错了什么?
编辑
As in this answer我去了我的项目目录,做了lein deps
a@b:~/command-line-args$ lein deps
Retrieving org/clojure/math.numeric-tower/0.0.2/math.numeric-tower-0.0.2.pom from central
Retrieving org/clojure/math.numeric-tower/0.0.2/math.numeric-tower-0.0.2.jar from central
a@b:~/command-line-args$
但我在 REPL 中仍然遇到同样的错误。
编辑2
根据 Vidya 的回答,我正在尝试使用 Pomegranate 但没有成功。这是我尝试过的。我做错了什么:
user> (use '[cemerick.pomegranate :only (add-dependencies)])
nil
user> (add-dependencies :coordinate '[[org.clojure/math.numeric-tower "0.0.2"]]
:repositories (merge cemerick.pomegranate.aether/maven-central
{"clojars" "http://clojars.org/repo"}))
{}
user> (require '(numeric-tower core stats charts))
FileNotFoundException Could not locate numeric_tower/core__init.class or numeric_tower/core.clj on classpath: clojure.lang.RT.load (RT.java:443)
user> (require 'clojure.contrib.math)
FileNotFoundException Could not locate clojure/contrib/math__init.class or clojure/contrib/math.clj on classpath: clojure.lang.RT.load (RT.java:443)
user>
【问题讨论】:
-
您在更改部门后是否重新启动了您的 repl? deps 仅在启动时发现
-
一切看起来都很好。您是否也重新启动了 REPL?
-
是的,我重新启动了 REPL。
-
我在我的项目目录中做了
lein deps,但我仍然在 REPL 中遇到同样的错误(请参阅我的问题的编辑)。 -
你是否从项目目录执行了lein repl?
标签: clojure dependencies leiningen read-eval-print-loop