Julia linspace出错:ERROR: UndefVarError: linspace not defined


#1

安装了PyPlot 和 PyCall,但是include(“test.jl”)的时候弹出ERROR: UndefVarError: linspace not defined的错误!请问各位,这该如何解决?


#2

python我也是有安装的,版本是3.6.5。难道是要和python.exe进行什么关联操作吗?


#3


好讨厌报这个linspace的错误!这是要让我放弃学Julia语言的节奏吗?


#4


#5
using PyCall
@pyimport numpy as np
n = 100
u = np.linspace(0,2*pi,n)

结果:

100-element Array{Float64,1}:
 0.0                
 0.06346651825433926
 0.12693303650867852
 0.1903995547630178 
 0.25386607301735703
 0.3173325912716963 
 0.3807991095260356 
 0.4442656277803748 
 0.5077321460347141 
 0.5711986642890533 
 0.6346651825433925 
 0.6981317007977318 
 0.7615982190520711 
 ⋮                  
 5.585053606381854  
 5.648520124636194  
 5.711986642890533  
 5.775453161144872  
 5.838919679399211  
 5.902386197653551  
 5.96585271590789   
 6.029319234162229  
 6.092785752416569  
 6.156252270670908  
 6.219718788925247  
 6.283185307179586  

#6