Julia从github添加包

  • 本文关键字:添加 github Julia julia
  • 更新时间 :
  • 英文 :


我想从github安装以下包。我尝试在我的环境中使用以下命令来安装

(nlpEnvJl) pkg> add "https://github.com/yeesian/LeafletJS.jl/tree/master/src"

但是我得到以下错误,

错误:无法在https://github.com/yeesian/LeafletJS.jl的包中找到项目文件,可能需要指定subdir

关于如何安装我有什么想法吗?我必须先把它克隆到我的本地仓库吗?如果是这样,我如何从本地路径安装?

干杯提前感谢

你不需要在本地安装,但你必须把URL官方克隆。

add https://github.com/yeesian/LeafletJS.jl.git

有时候,如果包已经注册了,你只想要github中的主版本,你可以直接执行

add PackageName#master

您必须在本地克隆它,然后使用Pkg.generate以便将其作为包导入。需要添加Project.toml文件

因此,您必须:

$ git clone git@github.com:yeesian/LeafletJS.jl.git                                                                                                                                                                                       
Cloning into 'LeafletJS.jl'...
remote: Enumerating objects: 59, done.
remote: Total 59 (delta 0), reused 0 (delta 0), pack-reused 59
Receiving objects: 100% (59/59), 14.83 KiB | 197.00 KiB/s, done.
Resolving deltas: 100% (22/22), done.
$ julia  

(@v1.5) pkg> generate LeafletJS
Generating  project LeafletJS:
LeafletJS/Project.toml
LeafletJS/src/LeafletJS.jl
$ cp -r LeafletJS.jl/* LeafletJS/.                                                                                                                                                                                                        
$ cd LeafletJS                                                                                                                                                                                                                            
LeafletJS $ julia  
(@v1.5) pkg> dev .
[ Info: Resolving package identifier `.` as a directory at `/tmp/jl_temp/LeafletJS/`.
Path `.` exists and looks like the correct package. Using existing path.
Resolving package versions...
Updating `~/.julia/environments/v1.5/Project.toml`
[b1ddfcb9] + LeafletJS v0.1.0 `../../../../../tmp/jl_temp/LeafletJS`
Updating `~/.julia/environments/v1.5/Manifest.toml`
[b1ddfcb9] + LeafletJS v0.1.0 `../../../../../tmp/jl_temp/LeafletJS`

最新更新