[英]Why is numpy.save not saving the file on linux
I'm trying to save a Numpy array in my system using numpy.save. 我正在尝试使用numpy.save在系统中保存一个Numpy数组。 The code is working fine without an error on windows but on linux, the code is working fine but it is not saving the numpy array to the desired location.
该代码在Windows上运行正常,没有错误,但在Linux上,该代码运行正常,但未将numpy数组保存到所需位置。 works fine in windows but on linux i can't see the file
在Windows中工作正常,但在Linux上我看不到文件
On windows: 在Windows上:
import numpy as np
dataset = np.arange(100)
np.save("C:\\Users\\Bhushan\\Documents\\Test.npy",dataset)
#working fine with file saved at the location
On linux: 在Linux上:
import numpy as np
dataset = np.arange(100)
np.save("Test.npy",dataset)
# It should save next to the program file but i couldn't see any numpy array file
What could be the problem? 可能是什么问题呢?
If you try 如果你试试
np.load("Test.npy")
you can see if it has actually saved it and you're looking in the wrong place 您可以查看它是否确实保存了它,并且查找位置错误
import os
os.path.abspath(".")
to see where you are (and where the file will be saved) 查看您的位置(以及文件的保存位置)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.