F#交互式CsvProvider未定义 [英] F# Interactive CsvProvider not defined

查看:85
本文介绍了F#交互式CsvProvider未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在交互式控制台中加载FSharp.Data.该库已加载,没有任何问题:

I'm loading FSharp.Data in the interactive console. The library is loaded without any problem:

> #r "FSharp.Data.dll";;

--> Referenced 'C:\Users\pw\AppData\Local\Temp\FSharp.Data.dll' (file may be locked by F# Interactive process)

> open FSharp.Data;;

但是,当我尝试初始化CsvProvider(在FSharp.Data中定义)时,出现错误消息,提示未定义类型:

However, when I'm trying to initialize CsvProvider (defined in FSharp.Data) I get the error message saying the type is not defined:

> type Stocks = CsvProvider<"C:\Users\pw\Downloads\msft.csv">;;

type Stocks = CsvProvider<"C:\Users\pw\Downloads\msft.csv">;;
--------------^^^^^^^^^^^

stdin(62,15): error FS0039: The type 'CsvProvider' is not defined

我认为问题可能出在文件和程序集路径上,但现在我使用的是绝对路径,并且错误仍然存​​在.另一方面,在创建标准而非交互式项目时,我可以使用CsvProvider.使其在交互式会话中工作的任何帮助都受到高度赞赏.

I thought the problem may be with file and assemblies paths but now I'm using absolute paths and the error remains. On the other hand, I am able to use the CsvProvider when I'm creating a standard, not interactive, project. Any help to make it work in interactive session highly appreciated.

推荐答案

关于文件被锁定的警告令人担忧.您可以将FSharp.Data复制到某个地方并使用绝对路径引用它吗?

The warning about file being locked looks worrisome. Can you copy FSharp.Data somewhere and reference it using absolute path:

\#r @"C:\Poligon\packages\FSharp.Data.2.1.0\lib\net40\FSharp.Data.dll";;

这篇关于F#交互式CsvProvider未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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