相关疑难解决方法(0)

内存上限?

python的内存是否有限制?我一直在使用python脚本来计算文件的平均值,该文件最小值为150mb.

根据文件的大小,我有时会遇到一个MemoryError.

可以为python分配更多的内存,所以我没有遇到错误?


编辑:现在的代码如下

注意:文件大小可能有很大差异(最大为20GB),文件的最小大小为150mb

file_A1_B1 = open("A1_B1_100000.txt", "r")
file_A2_B2 = open("A2_B2_100000.txt", "r")
file_A1_B2 = open("A1_B2_100000.txt", "r")
file_A2_B1 = open("A2_B1_100000.txt", "r")
file_write = open ("average_generations.txt", "w")
mutation_average = open("mutation_average", "w")

files = [file_A2_B2,file_A2_B2,file_A1_B2,file_A2_B1]

for u in files:
    line = u.readlines()
    list_of_lines = []
    for i in line:
        values = i.split('\t')
        list_of_lines.append(values)

    count = 0
    for j in list_of_lines:
        count +=1

    for k in range(0,count):
        list_of_lines[k].remove('\n')

    length = len(list_of_lines[0])
    print_counter = 4

    for o in range(0,length):
        total = 0 …
Run Code Online (Sandbox Code Playgroud)

python memory

25
推荐指数
5
解决办法
12万
查看次数

我们如何为Jupyter Notebook配置CPU和内存资源

我是刚开始使用Jupyter笔记本电脑的人。我已经使用Anaconda安装了Jupyter,并设置了一个jupyter服务器。我想控制Jupyter的CPU和内存。有什么配置吗?实现此目标的最佳方法是什么。

谢谢

anaconda jupyter-notebook

5
推荐指数
1
解决办法
3337
查看次数

标签 统计

anaconda ×1

jupyter-notebook ×1

memory ×1

python ×1