我在将 txt 文件从 Google 驱动器加载到 numpy 时遇到问题。它得到了 OSError。我将所有 .py 文件和 txt 文件放在同一个文件夹中,但它不起作用。我通读了一些类似的主题,似乎可能是因为该文件是由操作系统用户制作的(如果我理解正确的话)。
我的代码很简单,如下所示:
import numpy as np
data = np.loadtxt("weight_height_1.txt", delimiter=",")
错误信息:
https://i.stack.imgur.com/dgOFJ.png
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Long Le\AppData\Local\Programs\Python\Python38\lib\site-packages\numpy\lib\npyio.py", line 1065, in loadtxt
fh = np.lib._datasource.open(fname, 'rt', encoding=encoding)
File "C:\Users\Long Le\AppData\Local\Programs\Python\Python38\lib\site-packages\numpy\lib\_datasource.py", line 194, in open
return ds.open(path, mode, encoding=encoding, newline=newline)
File "C:\Users\Long Le\AppData\Local\Programs\Python\Python38\lib\site-packages\numpy\lib\_datasource.py", line 531, in open
raise IOError("%s not found." % path)
OSError: weight_height_1.txt not found.