1、parser.add_argument报错error:the following arguments are required:xx
argparse函数使用链接:https://docs.python.org/3.8/library/argparse.html#argparse._ActionsContainer.add_argument
在参数name of flahs: - Either a name or a list of option strings, e.g.
foo
or-f, --foo中,
可选参数(用--
指定),必选参数(不加--
指定)。我的代码用的必选参数,使用规则是没有问题的,但是报错,解决方法就是变成可选参数。原因是:用必选参数时,该参数需要在命令行内手动指定,如果此时通过defau
2、TypeError: expected str, bytes or os.PathLike object, not NoneType。 找到报错代码: main()
cfg = Config.fromfile(args.config)
cfg_dict, cfg_text = Config._file2dict(filename,
filename = osp.abspath(osp.expanduser(filename))
path = os.fspath(path)
报错原因是传入的参数nonetype,因此args.config可能没有输入或此处有问题。print(args.config)试一下,输出none,因而证明此处有问题。
3、AttributeError: module 'distutils' has no attribute 'version'原因是setuptools包版本过高
找到/home/zy/anaconda3/envs/bevfusion/lib/python3.8/site-packages/torch/utils/tensorboard/_init_.py文件,将代码修改如下:
import tensorboard
from setuptools import distutils#LooseVersion = distutils.version.LooseVersion
#if not hasattr(tensorboard, '__version__') or LooseVersion(tensorboard.__version__) < LooseVersion('1.15'):
# raise ImportError('TensorBoard logging requires TensorBoard version 1.15 or above')del distutils
#del LooseVersion
del tensorboardfrom .writer import FileWriter, SummaryWriter # noqa: F401
from tensorboard.summary.writer.record_writer import RecordWriter # noqa: F401
4、ValueError: too many values to unpack (expected 2)
该报错是函数返回值与参数值不匹配,以a,b=ls(aa,cc,vv)为例,ls函数只返回一个值,但是等号左边有两个参数,因此不匹配。解决办法:a=ls(aa,cc,vv)
5、安装mmcv报错pip install mmcv==2.0.0或者mim install "mmcv>=2.0.0"ERROR: Could not build wheels for mmcv, which is required to install pyproje
使用mim安装并带上包的存储库mim install mmcv==2.0.0 -f https://download.openmmlab.com/mmcv/dist/cu117/torch1.13/index.html