晚上好,我目前正在尝试从多边形中下载数据,但我无法编译代码,因为内核一直死机,这是代码。
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和几个包。然而我的努力一直没有成功。
先谢谢你的帮助。
最好的问候。
原来是RAM的问题,加上Jupyter不是合适的编译器。试试用PyCharm或者spyder或者其他的。