Nor*_*sey 81 haskell ghc cabal
Happstack Lite打破了我,因为它获得了blaze-html版本0.5,它需要版本0.4.Cabal表示安装了0.4.3.4和0.5.0.0 两个版本.我想删除0.5.0.0并仅使用旧版本.但是cabal没有"卸载"命令,当我尝试时ghc-pkg unregister --force blaze-html
,ghc-pkg
说我的命令被忽略了.
我该怎么办?
更新:不要相信.虽然ghc-pkg
声称忽略该命令,但该命令不会被忽略.在Don Stewart接受的答案中,您可以删除您想要删除的版本.
Don*_*art 94
您可以ghc-pkg unregister
使用特定版本,如下所示:
$ ghc-pkg unregister --force regex-compat-0.95.1
Run Code Online (Sandbox Code Playgroud)
这应该足够了.
mus*_*_ut 23
如果您在沙箱外面:
ghc-pkg unregister --force regex-compat-0.95.1
Run Code Online (Sandbox Code Playgroud)
如果你在cabal沙箱里面:
cabal sandbox hc-pkg -- unregister attoparsec --force
Run Code Online (Sandbox Code Playgroud)
第一个--
是参数分隔符hc-pkg
.这ghc-pkg
以沙箱意识的方式运行.
Dav*_*rak 20
还有cabal-uninstall包提供cabal-uninstall
命令.它取消注册包并删除该文件夹.值得一提的是它传递--force
给ghc-pkg unregister
它所以它可以打破其他包.
这是我用来卸载软件包的shell脚本.它支持多个安装版本的GHC并擦除相关文件(但提供没有保修,如果您软管安装,请不要责怪我!)
#!/bin/bash -eu
# Usage: ./uninstall.sh [--force | --no-unregister] pkgname-version
# if you set VER in the environment to e.g. "-7.0.1" you can use
# the ghc-pkg associated with a different GHC version
: ${VER:=}
if [ "$#" -lt 1 ]
then
echo "Usage: $0 [--force | --no-unregister] pkgname-version"
exit 1
fi
if [ "$1" == "--force" ]
then force=--force; shift; # passed to ghc-pkg unregister
else force=
fi
if [ "$1" == "--no-unregister" ]
then shift # skip unregistering and just delete files
else
if [ "$(ghc-pkg$VER latest $1)" != "$1" ]
then
# full version not specified: list options and exit
ghc-pkg$VER list $1; exit 1
fi
ghc-pkg$VER unregister $force $1
fi
# wipe library files
rm -rfv -- ~/.cabal/lib/$1/ghc-$(ghc$VER --numeric-version)/
# if the directory is left empty, i.e. not on any other GHC version
if rmdir -- ~/.cabal/lib/$1
then rm -rfv -- ~/.cabal/share/{,doc/}$1 # then wipe the shared files as well
fi
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
37115 次 |
最近记录: |