内核不断死亡,无法编译代码(osmnx)

Kernel keeps dying and can't compile code (osmnx)

晚上好,我目前正在尝试从多边形下载数据,但我无法编译代码,因为内核一直在死机。 这是代码:

import geopandas as gpd 
import pandas as pd 
from shapely.geometry import Point, LineString, Polygon 
import networkx as nx 
import osmnx as ox 
import matplotlib.pyplot as plt 
from descartes import PolygonPatch 
from IPython.display import IFrame 
ox.config(log_console=True, use_cache=True)

place = 'Portugal'

G = ox.gdf_from_place(place)

exploded_G = G.explode()

exploded_G['area'] = exploded_G.area
exploded_G.sort_values(by='area', inplace=True)

Portugal= exploded_G.iloc[-1]['geometry']

g = ox.graph_from_polygon(polygon = Portugal, network_type = 'drive')

内核在我分享的最后一行代码中死掉了。我不知道为什么,我在 anaconda 中创建了一个新环境并且 运行 代码又一次内核死了。我已经卸载并安装了 anaconda 和几个软件包。然而我的努力没有成功。

提前感谢您的帮助。

此致。

原来是内存问题,加上Jupyter不是合适的编译器。尝试使用 PyCharm 或 spyder 或 ohter。