简体   繁体   English

为什么numpy.save无法在Linux上保存文件

[英]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.

相关问题 乳清使用numpy.save/numpy.load将浮点数组的numpy数组保存到.npy文件中,是否有任何理由为什么数组的顺序会改变? - Whey saving an numpy array of float arrays to .npy file using numpy.save/numpy.load, is there any reason why the order of the arrays would change? 为什么使用numpy.save从数组中保存切片的速度较慢,具体取决于切片的方向? - Why does saving slices from an array using numpy.save is slower depending on the direction of the slice? 使用 numpy.save 保存并使用 pickle.load 加载时出错 - Error when saving with numpy.save and loading with pickle.load 从用numpy.save(...)保存的文件将numpy数组加载到C中 - Load a numpy array into C from a file that was saved with numpy.save(…) numpy.save(file,arr)是否可以与pypy一起使用? - Is there an alternative to numpy.save(file, arr) that will work with pypy? 在 numpy.save 中写入泡菜文件时出现 FileNotFoundError - FileNotFoundError when writing pickle file in numpy.save 有类似numpy.save的清单吗? - Is there an analog of numpy.save for lists? numpy.save跨平台吗? - Is numpy.save cross platform? 使用numpy.save保存Numpy 2D数组列表(这些数组一起是锯齿状的) - Saving List of Numpy 2D arrays using numpy.save (the arrays together are jagged) 为什么 numpy.save 为 sys.getsizeof 0.33MB 数据生成 100MB 文件? - Why does numpy.save produce 100MB file for sys.getsizeof 0.33MB data?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM