简体   繁体   English

如何在Appveyor中安装GHC并将其放置在路径中?

[英]How to install GHC in Appveyor and put GHC in path?

I'm trying to install GHC on windows with the following script (and put ghc in path), but it fails when I try to run ghci --version . 我正在尝试使用以下脚本在Windows上安装GHC(并将ghc放在路径中),但是当我尝试运行ghci --version时,它会失败。 I think there is something wrong with the script. 我认为脚本有问题。

install:
  - ps: Invoke-WebRequest "https://downloads.haskell.org/~ghc/8.0.2/ghc-8.0.2-i386-unknown-mingw32-win10.tar.xz" -OutFile "ghc-8.0.2-i386-unknown-mingw32-win10.tar.xz"
  - 7z x ghc-8.0.2-i386-unknown-mingw32-win10.tar.xz
  - ps: $env:path += "C:\projects\haskell-interactive-mode\ghc-8.0.2-i386-unknown-mingw32-win10.tar\ghc-8.0.2\bin"
  - ps: ghci --version

I tried your command on local Windows machine and I see that 7z x ghc-8.0.2-i386-unknown-mingw32-win10.tar.xz results in ghc-8.0.2-i386-unknown-mingw32-win10.tar file , not folder . 我在本地Windows机器上尝试了您的命令,然后看到7z x ghc-8.0.2-i386-unknown-mingw32-win10.tar.xz导致ghc-8.0.2-i386-unknown-mingw32-win10.tar 文件 ,不是文件夹 If you unzip it further with 7z x ghc-8.0.2-i386-unknown-mingw32-win10.tar , it unzips into real folder named ghc-8.0.2 with bin subfolder and ghci.exe file. 如果使用7z x ghc-8.0.2-i386-unknown-mingw32-win10.tar解压缩,它将解压缩到名为ghc-8.0.2真实文件夹中, ghci.exe包含bin子文件夹和ghci.exe文件。

However I think that simpler it would be use Chocolatey package . 但是我认为更简单的方法是使用Chocolatey软件包 This works for me well: 这对我很好:

  - choco install ghc
  - refreshenv
  - ghci --version

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

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