2024-10-04 05:34:48 发布
网友
我正在尝试使用
https://github.com/iandees/mongosm/blob/master/insert_osm_data.py
这个包裹。它似乎是用Python2写的。我一路转换成了next(context)。然而,我得到了name 'long' is not defined
next(context)
name 'long' is not defined
有什么方法可以让我在某个地方定义它吗?我如何定义“long”呢?我甚至不知道这对于Python2脚本(它在某种程度上工作得很好)有什么意义
您应该将所有代码转换为Python3
https://www.google.com/search?channel=fs&client=ubuntu&q=Converting+python2+to+python3https://docs.python.org/3/library/2to3.html
在Python 3中,long()基本上被重命名为int()。 详情请参阅https://www.python.org/dev/peps/pep-0237/
因此,要么搜索long并替换为int,要么定义它
long = int
文件开头的某个地方
您应该将所有代码转换为Python3
https://www.google.com/search?channel=fs&client=ubuntu&q=Converting+python2+to+python3https://docs.python.org/3/library/2to3.html
在Python 3中,long()基本上被重命名为int()。 详情请参阅https://www.python.org/dev/peps/pep-0237/
因此,要么搜索long并替换为int,要么定义它
文件开头的某个地方
相关问题 更多 >
编程相关推荐