我是Python新手,我有這個問題。當我運行我的劇本就說明這個錯誤:ImportError:無法導入名稱'inf'
Traceback (most recent call last):
File "./message", line 2, in <module>
from src.graph_lib import *
File "/export/home/xsymersk/TGR/src/graph_lib.py", line 2, in <module>
from math import inf
ImportError: cannot import name 'inf'
我的代碼有這個進口結構:
graph_lyb.py:
from src.dfs_lib import *
from math import inf
from collections import Counter
from operator import itemgetter
dfs_lib.py:
from enum import Enum
message.py:
from src.graph_lib import *
from sys import stdin
forest.py:
from src.graph_lib import *
from sys import stdin
race.py:
from src.graph_lib import *
from sys import stdin
代碼運行而不會inf
進口。
'math.inf'。 – vaultah