【发布时间】:2011-09-15 00:39:24
【问题描述】:
我正在一个具有 64GB RAM 的 Windows 服务器上运行分类/特征提取任务,不知何故,python 认为我的内存不足:
misiti@fff /cygdrive/c/NaiveBayes
$ python run_classify_comments.py > tenfoldcrossvalidation.txt
Traceback (most recent call last):
File "run_classify_comments.py", line 70, in <module>
run_classify_comments()
File "run_classify_comments.py", line 51, in run_classify_comments
NWORDS = get_all_words("./data/HUGETEXTFILE.txt")
File "run_classify_comments.py", line 16, in get_all_words
def get_all_words(path): return words(file(path).read())
File "run_classify_comments.py", line 15, in words
def words(text): return re.findall('[a-z]+', text.lower())
File "C:\Program Files (x86)\Python26\lib\re.py", line 175, in findall
return _compile(pattern, flags).findall(string)
MemoryError
所以 re 模块因 64 GB 的 RAM 而崩溃...我不这么认为... 为什么会发生这种情况,如何配置 python 以使用我机器上的所有可用 RAM?
【问题讨论】:
-
您的 Windows 版本是 64 位吗?你的 Python 版本是 64 位的吗?你检查过进程实际使用了多少内存吗?
-
Program Files (x86) 建议 windows 是 64 位的,但 python 不是