在我的脚本中,我具有以下导入内容:
from datasets import load_iris
import multiprocessing
from typing import Tuple
from deap import tools
from deap.algorithms import eaSimple as evolve
from deap.base import Toolbox
from sklearn.metrics import accuracy_score
import genesis as gen
import individuals
但是如果使用PyCharm的“优化导入”功能,导入将变为
import multiprocessing
from typing import Tuple
from deap import tools
from deap.algorithms import eaSimple as evolve
from deap.base import Toolbox
from sklearn.metrics import accuracy_score
import genesis as gen
import individuals
import mutations
from datasets import load_iris
如果我尝试使用优化版本运行脚本,则会收到以下警告:
C:\Python\WPy-3661\python-3.6.6.amd64\lib\importlib\_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
return f(*args, **kwds)
C:\Python\WPy-3661\python-3.6.6.amd64\lib\importlib\_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
return f(*args, **kwds)
为什么?
我已经尝试将自己的datasets.py重命名为whatino.py,并将load_iris函数重命名为loaderino。我仍然收到警告。