julia - 什么是 Julia 中 connect 的替代品?

标签 julia

julia> conn = connect(1234)

ERROR: UndefVarError: connect not defined
Stacktrace:
 [1] top-level scope at REPL[1]:1

更新后它不起作用,所以是否有任何新关键字被替换?
help?> connect
search: continue countlines count_ones

Couldn't find connect
Perhaps you meant convert, collect, const, count or conj
  No documentation found.

  Binding connect does not exist.

最佳答案

在尝试将预先存在的代码移植到 julia 1.x 时,Julia 0.7 版是一个方便的工具:对于 Julia 1.0.0 中已弃用的所有函数,julia 0.7 中会显示警告。

connect的具体情况下:

shell$ julia-0.7.0               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _  |  |
  | | |_| | | | (_| |  |  Version 0.7.0 (2018-08-08 06:46 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-pc-linux-gnu

julia> connect
WARNING: Base.connect is deprecated: it has been moved to the standard library package `Sockets`.
Add `using Sockets` to your imports.
 in module Main
connect (generic function with 8 methods)

按照此消息中提供的信息,connect现在应该用作:
using Sockets
socket = connect(1234)

关于julia - 什么是 Julia 中 connect 的替代品?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59634380/

相关文章:

loops - Julia 迭代数据帧的行

dictionary - 在 Julia 中展平字典

julia - 为什么 rand 不能与 AbstractFloat 一起使用?

tensorflow - 如何在 Julia 中将 TensorFlow 升级到 2.0?

string - 如何在 Julia 中将 Char 转换为 String?

julia - 列出 Julia 版本 1.0 中可供下载/安装的软件包

struct - 根据变量输入在 Julia 中创建结构

multithreading - Julia `remotecall`线程给出不同的结果

matplotlib - Julia Plots : PyCall. PyError("PyImport_ImportModule\n\npyimport 找不到 Python 包 matplotlib.pyplot

types - f(x::Real) 和 f{T <: Real}(x::T) 的区别?