码迷,mamicode.com
首页 > 其他好文 > 详细

使用scipy.genfromtxt()报错

时间:2015-03-07 11:20:06      阅读:1322      评论:0      收藏:0      [点我收藏+]

标签:

错误代码:

Traceback (most recent call last):
File "D:/Python27/1400OS_01_Codes/code/sp_genfromtxt.py", line 3, in <module>
data=sp.genfromtxt("web_traffic.tsv",delimiter="\t")
File "D:\Python27\lib\site-packages\numpy-1.9.1-py2.7-win-amd64.egg\numpy\lib\npyio.py", line 1360, in genfromtxt
fhd = iter(np.lib._datasource.open(fname, ‘rbU‘))
File "D:\Python27\lib\site-packages\numpy-1.9.1-py2.7-win-amd64.egg\numpy\lib\_datasource.py", line 151, in open
return ds.open(path, mode)
File "D:\Python27\lib\site-packages\numpy-1.9.1-py2.7-win-amd64.egg\numpy\lib\_datasource.py", line 501, in open
raise IOError("%s not found." % path)
IOError: web_traffic.tsv not found.

 解决办法:

程序保存为py文件,需要和读取文件"web_traffic.tsv"放在同一文件夹下。
如果该文件夹路径不在sys.path中:
import sys
sys.path.append(‘文件夹路径‘)

使用scipy.genfromtxt()报错

标签:

原文地址:http://www.cnblogs.com/wwww/p/4319928.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!