ubuntu haskell ghci 7.4.1找不到模块"System.Random". [英] ubuntu haskell ghci 7.4.1 could not find module "System.Random"

查看:56
本文介绍了ubuntu haskell ghci 7.4.1找不到模块"System.Random".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在ghci中加载.hs时,它在行上失败:

When I tried to load a .hs in ghci, it failed on the line:

import System.Random

消息:

Could not find module `System.Random'
Use -v to see a list of the files searched for.

我记得昨天它起作用了,今天突然间它不起作用了.仅当我在Windows haskell平台和我工作的其他linux机器上尝试此问题时,才在Ubuntu 12.04 LTS,GHCi 7.4.1上发生此问题.

I remember it worked yesterday and all of a sudden today it does not work. This problem only occurs on Ubuntu 12.04 LTS, GHCi 7.4.1 , when i tried this on windows haskell platform and other linux machines i worked.

我尝试使用

 sudo apt-get remove ghc
 sudo apt-get install ghc

删除并重新安装ghc,但是问题仍然存在.

to remove and re install ghc, but however the problem persists.

有人可以帮我吗?谢谢

推荐答案

您必须安装随机包.您可能可以从软件包管理器中获取它(例如 libghc-random-dev 之类的东西),也可以 cabal install random .

You must install the random package. You can probably get it from your package manager (as something like libghc-random-dev or similar), or you may cabal install random.

在2021年进行编辑如今, cabal install 成为了不可能.而是使用 cabal init 创建一个程序包,并在 build-depends 字段中列出 random .编译可以使用 cabal build (仅构建)或 cabal run (以执行结果)进行;可以通过 cabal repl 进行交互式使用.

Edit in 2021 These days, cabal install is not the way. Instead, use cabal init to create a package and list random in your build-depends field. Compilation can be performed with cabal build (just build) or cabal run (to execute the result); interactive use is available via cabal repl.

这篇关于ubuntu haskell ghci 7.4.1找不到模块"System.Random".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆