scipy安装,它的安装为啥要回溯?
Posted
技术标签:
【中文标题】scipy安装,它的安装为啥要回溯?【英文标题】:Scipy installation, its installed why the traceback?scipy安装,它的安装为什么要回溯? 【发布时间】:2014-08-24 01:30:31 【问题描述】:我正在运行以下代码(这是开始的sn-p):
# Import necessary modules and functions
########################################
# time module, for timing it.
from time import time
global starttime
starttime = time()
# psutil for indentifying processor and memory usage
#import psutil
# csv module for loading csv files
import csv
# numpy, a standard module for working with arrays
import numpy as np
# for randomly shuffling arrays
from random import shuffle
# for computing mean squared errors
from sklearn import metrics
# importing modules that contain models we will use
from sklearn import linear_model, ensemble, gaussian_process
from sklearn import neural_network, svm
# importing memory profiler to enable us to determine peak memory usage
from memory_profiler import profile
# Helpful functions
###################
#psutilpercent = psutil.virtual_memory()
#print "\n", " --> Memory Check 1 Percent:", str(psutilpercent.percent) + "%\n"
# This function is for simplifying reading CSV files
def readCSV(path):
"""
Read a CSV file of floats, with no headder
"""
data = []
mycsv = csv.reader(open(path), delimiter="|")
for counter, row in enumerate(mycsv):
if counter != 0:
data.append(row)
return np.asarray(data, dtype=np.float32)
但是我收到了回溯:
Traceback (most recent call last):
File "C:\Users\regression_v6.py", line 38, in <module>
from sklearn import metrics
File "C:\Python27\lib\site-packages\sklearn\__init__.py", line 32, in <module>
from .base import clone
File "C:\Python27\lib\site-packages\sklearn\base.py", line 10, in <module>
from scipy import sparse
ImportError: No module named scipy
但我的电脑显示 Scipy 已安装,这是控制面板\所有控制面板项\程序和功能的视图:
有什么想法吗?
【问题讨论】:
PYTHONPATH
?你能在 Python shell 中 import scipy
吗?
【参考方案1】:
您是否安装了特殊版本的 scipy?如您的屏幕截图所示'scipy_umfpack'
我可以使用从sourceforge下载的正式版成功import sklearn
:http://sourceforge.net/projects/scipy/files/scipy/
【讨论】:
hmmm 我可能已经将它作为 Python XY 包的一部分安装了 code.google.com/p/pythonxy 你们两个希望我提供什么?告诉我我应该记下的答案,而不是我记下的内容。以上是关于scipy安装,它的安装为啥要回溯?的主要内容,如果未能解决你的问题,请参考以下文章