Windows 为什么numpy&x2B;mkl让我的目标无法实现?
此代码用于在安装scipy之前“收集”我的所有文本数据:Windows 为什么numpy&x2B;mkl让我的目标无法实现?,windows,python-2.7,numpy,scipy,Windows,Python 2.7,Numpy,Scipy,此代码用于在安装scipy之前“收集”我的所有文本数据: #load a list with the filenames in root folder with .Spectrum extensions, stripping only the absorbance values Spectral_Output = [] for file in glob.glob("*.Spectrum"): Spectral_Output.append( numpy.loadtxt(fi
#load a list with the filenames in root folder with .Spectrum extensions, stripping only the absorbance values
Spectral_Output = []
for file in glob.glob("*.Spectrum"):
Spectral_Output.append(
numpy.loadtxt(file, skiprows=1, usecols=(1)))
#convert to a numpy array and print dimensions
spectral_data = numpy.asarray(Spectral_Output)
print(spectral_data.shape)
#take only column 26 or the values for 2268; print stuff
Absorbance2268 = spectral_data[:, 25]
然后我想在另一个浓度数组上运行一个regression stats.linregresse(x,y),所以我安装了Scipy
由于某些原因,pip不会在Windows上集成所有scipy,所以我安装了
numpy-1.11.3+mkl-cp27-cp27m-win32.whl
及
scipy-0.19.0-cp27-cp27m-win32.whl
从这里开始:根据scipy网站的建议
现在,代码抛出以下错误:
Traceback (most recent call last):
File "C:\Spectrometer\Spectrometer\0330\Spectrum.py", line 31, in <module>
numpy.loadtxt(file, skiprows=1, usecols=(1)))
File "C:\Python27\lib\site-packages\numpy\lib\npyio.py", line 790, in loadtxt
usecols = list(usecols)
TypeError: 'int' object is not iterable
回溯(最近一次呼叫最后一次):
文件“C:\Spectrum\Spectrum\0330\Spectrum.py”,第31行,在
loadtxt(文件,skiprows=1,usecols=(1)))
loadtxt中的文件“C:\Python27\lib\site packages\numpy\lib\npyio.py”,第790行
usecols=列表(usecols)
TypeError:“int”对象不可编辑
我太不适合了。任何帮助都将不胜感激 列的元组只有一个元素,因此您需要一个尾随逗号,否则它将不会被解释为iterable:
numpy.loadtxt(文件,skiprows=1,usecols=(1,)))
在numpy 1.11中,与最新版本不同,不允许使用
usecols
的整数值。当您安装whl时,您可能已经降低了版本 列的元组只有一个元素,因此您需要一个尾随逗号,否则它将不会被解释为iterable:
numpy.loadtxt(文件,skiprows=1,usecols=(1,)))
在numpy 1.11中,与最新版本不同,不允许使用usecols
的整数值。当您安装whl时,您可能已经降低了版本