import obspy时报错
line = line.split(comment, 1)[0] AttributeError: 'numpy.int64' object has no attribute 'split'
File "/Users/jiangyue/miniforge3/envs/python38/lib/python3.8/site-packages/numpy/lib/npyio.py", line 977, in split_line line = line.split(comment, 1)[0]
打开这个npyio.py文件,找到报错的这一行
def split_line(line: str):
"""Chop off comments, strip, and split at delimiter."""
for comment in comments: # Much faster than using a single regex.
line = line.split(comment, 1)[0]
line = line.strip('\r\n')
return line.split(delimiter) if line else []
把line转换为str类型:
def split_line(line: str):
"""Chop off comments, strip, and split at delimiter."""
for comment in comments: # Much faster than using a single regex.
line = str(line).split(comment, 1)[0]
line = line.strip('\r\n')
return line.split(delimiter) if line else []