【问题标题】:PostgreSQL "Could not find module"PostgreSQL“找不到模块”
【发布时间】:2015-07-04 12:58:47
【问题描述】:

我正在尝试将 Posgres 和 cabal 沙箱用于新项目。我已经安装了postgresql-simple,安装输出证明了这一点:

$ cabal install postgresql-simple
Resolving dependencies...
All the requested packages are already installed:
postgresql-simple-0.4.10.0
Use --reinstall if you want to reinstall anyway.
Notice: installing into a sandbox located at
/Users/inaimathi/projects/hs-test/.cabal-sandbox

但是当我尝试在ghci 中导入库时,我得到了错误

ghci
GHCi, version 7.10.1: http://www.haskell.org/ghc/  :? for help
Prelude> import Database.PostgreSQL.Simple
import Database.PostgreSQL.Simple

<no location info>:
    Could not find module ‘Database.PostgreSQL.Simple’
    It is not a module in the current program, or in any known package.
Prelude> 

谁能指出我做错了什么?

【问题讨论】:

    标签: haskell package cabal


    【解决方案1】:

    你需要用一个指向/Users/inaimathi/projects/hs-test/.cabal-sandbox-package-db=...标志来启动GHCi

    所以 ghci -package-db=/Users/inaimathi/projects/hs-test/.cabal-sandbox 或者附近...

    【讨论】:

    • 这给了我错误/Users/inaimathi/projects/hs-test/.cabal-sandbox/package.cache: openBinaryFile: does not exist (No such file or directory),之后ghci 退出。我必须做ghci -package-db .cabal-sandbox/x86_64-osx-ghc-7.10.1-packages.conf.d(最后一部分是特定于架构的)。 This answer 帮助。
    • 是的,因此我的“或附近...”无法检查 Mac 的答案是什么...
    猜你喜欢
    • 2022-12-15
    • 2018-02-21
    • 2021-07-23
    • 1970-01-01
    相关资源
    最近更新 更多