我的报错合集

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 tensorboard

from .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
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值