无法在haskell平台上使用cabal初始化沙箱

无法在haskell平台上使用cabal初始化沙箱,haskell,cabal,cabal-install,Haskell,Cabal,Cabal Install,我已经完成了以下步骤来安装阴谋集团。我已经使用sudo apt get安装haskell平台安装了haskell平台 然而,当我尝试初始化沙盒时,它抛出如下错误 vagrant@vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal sandbox --help cabal: unrecognised command: sandbox (try --help) 添加更多详细信息: vagrant@vagrant-ubuntu-tru

我已经完成了以下步骤来安装阴谋集团。我已经使用
sudo apt get安装haskell平台安装了haskell平台

然而,当我尝试初始化沙盒时,它抛出如下错误

vagrant@vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal sandbox --help
cabal: unrecognised command: sandbox (try --help)
添加更多详细信息:

vagrant@vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
vagrant@vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ which cabal
/home/vagrant/.cabal/bin/cabal



vagrant@vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal --help
This program is the command line interface to the Haskell Cabal infrastructure.
See http://www.haskell.org/cabal/ for more information.

Usage: cabal COMMAND [FLAGS]
   or: cabal [GLOBAL FLAGS]

Global flags:
 -h --help            Show this help text
 -V --version         Print version information
    --numeric-version Print just the version number

Commands:
  install      Installs a list of packages.
  update       Updates list of known packages
  list         List packages matching a search string.
  info         Display detailed information about a particular package.
  fetch        Downloads packages for later installation.
  unpack       Unpacks packages for user inspection.
  check        Check the package for common mistakes
  sdist        Generate a source distribution file (.tar.gz).
  upload       Uploads source packages to Hackage
  report       Upload build reports to a remote server.
  init         Interactively create a .cabal file.
  configure    Prepare to build the package.
  build        Make this package ready for installation.
  copy         Copy the files into the install locations.
  haddock      Generate Haddock HTML documentation.
  clean        Clean up after a build.
  hscolour     Generate HsColour colourised code, in HTML format.
  register     Register this package with the compiler.
  test         Run the test suite, if any (configure with UserHooks).
  bench        Run the benchmark, if any (configure with UserHooks).
  upgrade      (command disabled, use install instead)
  help         Help about commands

For more information about a command use:
  cabal COMMAND --help

To install Cabal packages from hackage use:
  cabal install foo [--dry-run]

Occasionally you need to update the list of available packages:
  cabal update

You can edit the cabal configuration file to set defaults:
  /home/vagrant/.cabal/config
vagrant@vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal COMMAND --help
cabal: unrecognised command: COMMAND (try --help)
vagrant@vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal sandbox --help
cabal: unrecognised command: sandbox (try --help)

apt
安装的阴谋集团有点旧,这可能是您的
路径中的阴谋集团。它被安装到
/usr/bin
。您可以通过以下方式进行检查:

which cabal
要查看版本,请执行以下操作:

cabal -v
您应该首先使用以下命令将其放入路径中的
~/.cabal/bin

export PATH="$HOME/.cabal/bin:$PATH
(最好将其放入您的
~/.bash_配置文件
或类似文件中)

在我的系统上:

.whogan:~$ which cabal
/home/whogan/.cabal/bin/cabal

.whogan:~$ cabal -V
cabal-install version 1.22.6.0
using version 1.22.4.0 of the Cabal library 

.whogan:~$ /usr/bin/cabal -V
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library 
编辑:尝试使用新的Vagrant box,运行
apt获取安装haskell平台
并从git安装:

[vagrant@vagrantbox:~] $ git clone git://github.com/haskell/cabal.git cabal-wip
Cloning into 'cabal-wip'...
remote: Counting objects: 48926, done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 48926 (delta 16), reused 0 (delta 0), pack-reused 48876
Receiving objects: 100% (48926/48926), 26.39 MiB | 10.37 MiB/s, done.
Resolving deltas: 100% (29033/29033), done.
Checking connectivity... done.

[vagrant@vagrantbox:~] $ cd cabal-wip
[vagrant@vagrantbox:~/cabal-wip][master] $ cabal install Cabal/ cabal-install/
Config file path source is default config file.
Config file /home/vagrant/.cabal/config not found.
Writing default configuration to /home/vagrant/.cabal/config
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Resolving dependencies...
Configuring Cabal-1.23.0.0...
Building Cabal-1.23.0.0...
Preprocessing library Cabal-1.23.0.0...
[ 1 of 85] Compiling Distribution.Lex ( Distribution/Lex.hs, dist/build/Distribution/Lex.o )
..
[85 of 85] Compiling Distribution.Simple ( Distribution/Simple.hs, dist/build/Distribution/Simple.o )
In-place registering Cabal-1.23.0.0...
Installing library in /home/vagrant/.cabal/lib/Cabal-1.23.0.0/ghc-7.6.3
Registering Cabal-1.23.0.0...
Installed Cabal-1.23.0.0
[1 of 1] Compiling Main             ( cabal-install/Setup.hs, cabal-install/dist/setup/Main.o )
Linking cabal-install/dist/setup/setup ...
Configuring cabal-install-1.23.0.0...
Building cabal-install-1.23.0.0...
Preprocessing executable 'cabal' for cabal-install-1.23.0.0...
[ 1 of 81] Compiling Distribution.Client.Utils.LabeledGraph ( Distribution/Client/Utils/LabeledGraph.hs, dist/build/cabal/cabal-tmp/Distribution/Client/Utils/LabeledGraph.o )
...
[81 of 81] Compiling Main             ( Main.hs, dist/build/cabal/cabal-tmp/Main.o )
Linking dist/build/cabal/cabal ...
Generating manual page dist/build/cabal/cabal.1 ...
Installing executable(s) in /home/vagrant/.cabal/bin
Installed cabal-install-1.23.0.0
它安装在1.23.0.0至
~/.cabal/bin
,但在此之后
路径仍然指向系统路径:

[vagrant@vagrantbox:~/cabal-wip][master] $ which cabal
/usr/bin/cabal
[vagrant@vagrantbox:~/cabal-wip][master] $ cabal -V
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
因此,我修改为将user/git版本放在第一位:

[vagrant@vagrantbox:~/cabal-wip][master] $ export PATH="~/.cabal/bin:$PATH"
[vagrant@vagrantbox:~/cabal-wip][master] $ which cabal
/home/vagrant/.cabal/bin/cabal
[vagrant@vagrantbox:~/cabal-wip][master] $ cabal -V
cabal-install version 1.23.0.0
compiled using version 1.23.0.0 of the Cabal library 
在那之后似乎还可以:

[vagrant@vagrantbox:~/cabal-wip][master] $ mkdir ~/tmp && cd ~/tmp
[vagrant@vagrantbox:~/tmp] $ cabal sandbox init
Writing a default package environment file to
/home/vagrant/tmp/cabal.sandbox.config
Creating a new sandbox at /home/vagrant/tmp/.cabal-sandbox

我使用了trusty64而不是trusty32,但我希望在这种情况下这并不重要。

cabal sandbox
仅适用于cabal install 1.18及以上版本。
cabal--version
告诉你什么?我相信Ubuntu的软件包系统有一个过时的haskell平台(看起来至少过时了几年,这是非常过时的)。我建议从其他来源安装它。vagrant@vagrant-ubuntu-trusty-32:/usr/lib/haskell软件包$cabal——版本cabal使用cabal库的1.16.0版安装版本1.16.0.2vagrant@vagrant-ubuntu-trusty-32:/usr/lib/haskell包$which-cabal/home/vagrant/.cabal/bin/cabal@DavidYoung:我添加了更多细节。Check@Zack好吧,就像我说的,我建议从更新的来源获得haskell平台/ghc。该安装最多可能有GHC 7.6.3,这是最新稳定版本之后的两个(很快将是三个)主要版本(并且在功能数量上存在很大差异。您可能会遇到许多与Haskell库不兼容的问题)。不过,您可能只需升级cabal(这不会升级GHC编译器),就可以解决这个特定问题。这可以通过
cabal update&&cabal install-cabal install
完成。你的回答对我没有任何帮助。你能详细说明一下如何修正这个错误吗?正如我在帖子中提到的,Cabal已经在我的路径中了。我知道它在你的
路径中,我的观点是系统级安装首先在你的
路径中,这个安装与
~/.Cabal/bin中的用户级安装不同。要解决这个问题,正如我所说,您可以使用
export path=“$HOME/.cabal/bin:$path”
修改路径,将用户级别一放在第一位。博客文章中也提到了这一点,他们说“就这些!现在你已经在~/.cabal/bin下安装了最新版本的cabal工具”。哪个阴谋集团的输出是什么?如果它不是
~/.cabal/bin
,那么你需要修复你的路径。好的。我要试试这个。也许我错过了这一步。谢谢。我看到你在上面的另一个线程中注意到了路径,你在
~/.cabal/bin
中得到了1.16。虽然我不明白从git源代码安装时怎么会发生这种情况,但您可能应该接受David Young的建议。谢谢。我可以通过登录VM以交互方式完成这项工作。然而,当我通过vagrantfile做同样的事情时,我面临着问题。你能查一下这个帖子吗
[vagrant@vagrantbox:~/cabal-wip][master] $ mkdir ~/tmp && cd ~/tmp
[vagrant@vagrantbox:~/tmp] $ cabal sandbox init
Writing a default package environment file to
/home/vagrant/tmp/cabal.sandbox.config
Creating a new sandbox at /home/vagrant/tmp/.cabal-sandbox