在init .py' 中找不到引用 path config

时间: 2024-02-04 16:51:16 浏览: 31
如果在 `__init__.py` 中找不到 `path config` 的引用,可能是因为该引用不在该模块中定义,或者引用不正确。 你可以尝试检查以下几点: - 确保 `path config` 在其他模块中定义,例如在同一包中的其他模块中。 - 检查引用的正确性,确保你使用的是正确的变量名或模块名。 - 如果 `path config` 是在其他模块中定义的,则需要在当前模块中导入该模块,例如 `from module import path config`。 如果以上步骤都检查过了,还是找不到该引用,可能需要检查你的代码是否存在其他错误或问题。
相关问题

import shutil import os import platform from common.file_config import FileConfig # 清除历史数据 def delete_file(*path): # 清除输入结果中的内容 for path in [*path]: all_log_files = os.listdir(path) all_log_files.sort() # 遍历 for num in range(len(all_log_files)): if os.path.basename(os.path.join(path,all_log_files[num])) != "__init__.py": try: os.remove(os.path.join(path,all_log_files[num])) except: shutil.rmtree(os.path.join(path,all_log_files[num])) # 清除上一次pytest运行缓存 if platform.system() == "Windows": cache_dir = os.path.join(FileConfig().base_dir + "\.pytest_cache") # Linux系统 else: cache_dir = os.path.join(FileConfig().base_dir + "/.pytest_cache") shutil.rmtree(cache_dir) if __name__ == "__main__": pass

你的代码看起来像是一个Python脚本,它导入了shutil、os和platform等模块,并从common.file_config中导入了FileConfig类。该脚本定义了一个名为delete_file的函数,该函数接受一个或多个路径参数,并删除指定路径中的所有文件和文件夹(除了名称为“__init__.py”的文件)。另外,该函数还会清除pytest运行缓存。最后,该脚本定义了一个名为“__main__”的条件语句,但这个条件语句没有任何内容,所以它实际上不会执行任何操作。

ImportError: cannot import name 'items' from 'config' (D:\app\anaconda3\envs\py37\lib\site-packages\config\__init__.py)

这个错误提示是在导入config包中的items模块时出现了问题。可能的原因是items模块不存在或者包路径不正确。你可以检查一下以下几点: 1. 确认items模块是否存在于config包中。 2. 确认你的包路径是否正确,可以使用sys.path查看当前环境的包路径。 3. 确认你的代码中是否正确导入了items模块,例如是否使用了正确的语法from config import items。 如果以上方法都无法解决问题,那么可能是包重名了。你可以尝试将你自己写的包的名称改成不一样的,然后修改代码中的导入语句即可。

相关推荐

[root@zabbix roles]# ansible-doc Traceback (most recent call last): File "/usr/bin/ansible-doc", line 62, in <module> import ansible.constants as C File "/usr/lib/python2.7/site-packages/ansible/constants.py", line 175, in <module> config = ConfigManager() File "/usr/lib/python2.7/site-packages/ansible/config/manager.py", line 283, in __init__ self._config_file = find_ini_config_file(self.WARNINGS) File "/usr/lib/python2.7/site-packages/ansible/config/manager.py", line 240, in find_ini_config_file potential_paths.append(unfrackpath("~/.ansible.cfg", follow=False)) File "/usr/lib/python2.7/site-packages/ansible/utils/path.py", line 55, in unfrackpath b_basedir = to_bytes(os.getcwd(), errors='surrogate_or_strict') OSError: [Errno 2] No such file or directory [root@zabbix roles]# ansible Traceback (most recent call last): File "/usr/bin/ansible", line 62, in <module> import ansible.constants as C File "/usr/lib/python2.7/site-packages/ansible/constants.py", line 175, in <module> config = ConfigManager() File "/usr/lib/python2.7/site-packages/ansible/config/manager.py", line 283, in __init__ self._config_file = find_ini_config_file(self.WARNINGS) File "/usr/lib/python2.7/site-packages/ansible/config/manager.py", line 240, in find_ini_config_file potential_paths.append(unfrackpath("~/.ansible.cfg", follow=False)) File "/usr/lib/python2.7/site-packages/ansible/utils/path.py", line 55, in unfrackpath b_basedir = to_bytes(os.getcwd(), errors='surrogate_or_strict') OSError: [Errno 2] No such file or directory

(env) (base) PS D:\MiniGPT-4> python demo.py --cfg-path eval_configs/minigpt4_eval.yaml Initializing Chat Loading VIT Loading VIT Done Loading Q-Former Traceback (most recent call last): File "D:\MiniGPT-4\env\lib\site-packages\transformers\utils\hub.py", line 409, in cached_file resolved_file = hf_hub_download( File "D:\MiniGPT-4\env\lib\site-packages\huggingface_hub\utils\_validators.py", line 120, in _inner_fn return fn(*args, **kwargs) File "D:\MiniGPT-4\env\lib\site-packages\huggingface_hub\file_download.py", line 1259, in hf_hub_download raise LocalEntryNotFoundError( huggingface_hub.utils._errors.LocalEntryNotFoundError: Connection error, and we cannot find the requested files in the disk cache. Please try again or make sure your Internet connection is on. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\MiniGPT-4\demo.py", line 57, in <module> model = model_cls.from_config(model_config).to('cuda:0') File "D:\MiniGPT-4\minigpt4\models\mini_gpt4.py", line 241, in from_config model = cls( File "D:\MiniGPT-4\minigpt4\models\mini_gpt4.py", line 64, in __init__ self.Qformer, self.query_tokens = self.init_Qformer( File "D:\MiniGPT-4\minigpt4\models\blip2.py", line 47, in init_Qformer encoder_config = BertConfig.from_pretrained("bert-base-uncased") File "D:\MiniGPT-4\env\lib\site-packages\transformers\configuration_utils.py", line 546, in from_pretrained config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs) File "D:\MiniGPT-4\env\lib\site-packages\transformers\configuration_utils.py", line 573, in get_config_dict config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs) File "D:\MiniGPT-4\env\lib\site-packages\transformers\configuration_utils.py", line 628, in _get_config_dict resolved_config_file = cached_file( File "D:\MiniGPT-4\env\lib\site-packages\transformers\utils\hub.py", line 443, in cached_file raise EnvironmentError( OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like bert-base-uncased is not the path to a directory containing a file named config.json. Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.

python detect.py /usr/lib/python3/dist-packages/pkg_resources/__init__.py:1235: UserWarning: /home/ucar/.cache/Python-Eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable). warnings.warn(msg, UserWarning) Downloading https://ultralytics.com/assets/Arial.ttf to /home/ucar/.config/Ultralytics/Arial.ttf... Traceback (most recent call last): File "/home/ucar/yolov3-9.6.0/utils/plots.py", line 58, in check_font return ImageFont.truetype(str(font) if font.exists() else font.name, size) File "/usr/local/lib/python3.6/dist-packages/PIL/ImageFont.py", line 655, in truetype return freetype(font) File "/usr/local/lib/python3.6/dist-packages/PIL/ImageFont.py", line 652, in freetype return FreeTypeFont(font, size, index, encoding, layout_engine) File "/usr/local/lib/python3.6/dist-packages/PIL/ImageFont.py", line 194, in __init__ font, size, index, encoding, layout_engine=layout_engine OSError: cannot open resource During handling of the above exception, another exception occurred: Traceback (most recent call last): File "detect.py", line 30, in <module> from models.common import DetectMultiBackend File "/home/ucar/yolov3-9.6.0/models/common.py", line 25, in <module> from utils.plots import Annotator, colors, save_one_box File "/home/ucar/yolov3-9.6.0/utils/plots.py", line 70, in <module> class Annotator: File "/home/ucar/yolov3-9.6.0/utils/plots.py", line 72, in Annotator check_font() # download TTF if necessary File "/home/ucar/yolov3-9.6.0/utils/plots.py", line 64, in check_font return ImageFont.truetype(str(font), size) File "/usr/local/lib/python3.6/dist-packages/PIL/ImageFont.py", line 655, in truetype return freetype(font) File "/usr/local/lib/python3.6/dist-packages/PIL/ImageFont.py", line 652, in freetype return FreeTypeFont(font, size, index, encoding, layout_engine) File "/usr/local/lib/python3.6/dist-packages/PIL/ImageFont.py", line 194, in __init__ font, size, index, encoding, layout_engine=layout_engine OSError: cannot open resource

TypeError Traceback (most recent call last) /tmp/ipykernel_1045/245448921.py in <module> 1 dataset_path = ABSADatasetList.Restaurant14 ----> 2 sent_classifier = Trainer(config=apc_config_english, 3 dataset=dataset_path, # train set and test set will be automatically detected 4 checkpoint_save_mode=1, # =None to avoid save model 5 auto_device=True # automatic choose CUDA or CPU /tmp/ipykernel_1045/296492999.py in __init__(self, config, dataset, from_checkpoint, checkpoint_save_mode, auto_device) 84 config.model_path_to_save = None 85 ---> 86 self.train() 87 88 def train(self): /tmp/ipykernel_1045/296492999.py in train(self) 96 config.seed = s 97 if self.checkpoint_save_mode: ---> 98 model_path.append(self.train_func(config, self.from_checkpoint, self.logger)) 99 else: 100 # always return the last trained model if dont save trained model /tmp/ipykernel_1045/4269211813.py in train4apc(opt, from_checkpoint_path, logger) 494 load_checkpoint(trainer, from_checkpoint_path) 495 --> 496 return trainer.run() /tmp/ipykernel_1045/4269211813.py in run(self) 466 criterion = nn.CrossEntropyLoss() 467 self._reset_params() --> 468 return self._train(criterion) 469 470 /tmp/ipykernel_1045/4269211813.py in _train(self, criterion) 153 return self._k_fold_train_and_evaluate(criterion) 154 else: --> 155 return self._train_and_evaluate(criterion) 156 157 def _train_and_evaluate(self, criterion): /tmp/ipykernel_1045/4269211813.py in _train_and_evaluate(self, criterion) 190 191 for epoch in range(self.opt.num_epoch): --> 192 iterator = tqdm(self.train_dataloaders[0]) 193 for i_batch, sample_batched in enumerate(iterator): 194 global_step += 1 TypeError: 'module' object is not callable

Traceback (most recent call last): File "/usr/local/python3/bin/pyinstaller", line 8, in <module> sys.exit(_console_script_run()) File "/usr/local/python3/lib/python3.7/site-packages/PyInstaller/__main__.py", line 194, in _console_script_run run() File "/usr/local/python3/lib/python3.7/site-packages/PyInstaller/__main__.py", line 180, in run run_build(pyi_config, spec_file, **vars(args)) File "/usr/local/python3/lib/python3.7/site-packages/PyInstaller/__main__.py", line 61, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "/usr/local/python3/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 1019, in main build(specfile, distpath, workpath, clean_build) File "/usr/local/python3/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 944, in build exec(code, spec_namespace) File "/root/test/2.spec", line 20, in <module> noarchive=False, File "/usr/local/python3/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 429, in __init__ self.__postinit__() File "/usr/local/python3/lib/python3.7/site-packages/PyInstaller/building/datastruct.py", line 184, in __postinit__ self.assemble() File "/usr/local/python3/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 764, in assemble self._check_python_library(self.binaries) File "/usr/local/python3/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 834, in _check_python_library python_lib = bindepend.get_python_library_path() File "/usr/local/python3/lib/python3.7/site-packages/PyInstaller/depend/bindepend.py", line 1018, in get_python_library_path raise IOError(msg) OSError: Python library not found: libpython3.7mu.so.1.0, libpython3.7.so, libpython3.7m.so.1.0, libpython3.7m.so, libpython3.7.so.1.0 This means your Python installation does not come with proper shared library files. This usually happens due to missing development package, or unsuitable build parameters of the Python installation. * On Debian/Ubuntu, you need to install Python development packages: * apt-get install python3-dev * apt-get install python-dev * If you are building Python by yourself, rebuild with --enable-shared (or, --enable-framework on macOS).

最新推荐

recommend-type

pre_o_1csdn63m9a1bs0e1rr51niuu33e.a

pre_o_1csdn63m9a1bs0e1rr51niuu33e.a
recommend-type

matlab建立计算力学课程的笔记和文件.zip

matlab建立计算力学课程的笔记和文件.zip
recommend-type

FT-Prog-v3.12.38.643-FTD USB 工作模式设定及eprom读写

FT_Prog_v3.12.38.643--FTD USB 工作模式设定及eprom读写
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

实现实时数据湖架构:Kafka与Hive集成

![实现实时数据湖架构:Kafka与Hive集成](https://img-blog.csdnimg.cn/img_convert/10eb2e6972b3b6086286fc64c0b3ee41.jpeg) # 1. 实时数据湖架构概述** 实时数据湖是一种现代数据管理架构,它允许企业以低延迟的方式收集、存储和处理大量数据。与传统数据仓库不同,实时数据湖不依赖于预先定义的模式,而是采用灵活的架构,可以处理各种数据类型和格式。这种架构为企业提供了以下优势: - **实时洞察:**实时数据湖允许企业访问最新的数据,从而做出更明智的决策。 - **数据民主化:**实时数据湖使各种利益相关者都可
recommend-type

SPDK_NVMF_DISCOVERY_NQN是什么 有什么作用

SPDK_NVMF_DISCOVERY_NQN 是 SPDK (Storage Performance Development Kit) 中用于查询 NVMf (Non-Volatile Memory express over Fabrics) 存储设备名称的协议。NVMf 是一种基于网络的存储协议,可用于连接远程非易失性内存存储器。 SPDK_NVMF_DISCOVERY_NQN 的作用是让存储应用程序能够通过 SPDK 查询 NVMf 存储设备的名称,以便能够访问这些存储设备。通过查询 NVMf 存储设备名称,存储应用程序可以获取必要的信息,例如存储设备的IP地址、端口号、名称等,以便能
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。
recommend-type

"互动学习:行动中的多样性与论文攻读经历"

多样性她- 事实上SCI NCES你的时间表ECOLEDO C Tora SC和NCESPOUR l’Ingén学习互动,互动学习以行动为中心的强化学习学会互动,互动学习,以行动为中心的强化学习计算机科学博士论文于2021年9月28日在Villeneuve d'Asq公开支持马修·瑟林评审团主席法布里斯·勒菲弗尔阿维尼翁大学教授论文指导奥利维尔·皮耶昆谷歌研究教授:智囊团论文联合主任菲利普·普雷教授,大学。里尔/CRISTAL/因里亚报告员奥利维耶·西格德索邦大学报告员卢多维奇·德诺耶教授,Facebook /索邦大学审查员越南圣迈IMT Atlantic高级讲师邀请弗洛里安·斯特鲁布博士,Deepmind对于那些及时看到自己错误的人...3谢谢你首先,我要感谢我的两位博士生导师Olivier和Philippe。奥利维尔,"站在巨人的肩膀上"这句话对你来说完全有意义了。从科学上讲,你知道在这篇论文的(许多)错误中,你是我可以依
recommend-type

实现实时监控告警系统:Kafka与Grafana整合

![实现实时监控告警系统:Kafka与Grafana整合](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6X2pwZy9BVldpY3ladXVDbEZpY1pLWmw2bUVaWXFUcEdLT1VDdkxRSmQxZXB5R1lxaWNlUjA2c0hFek5Qc3FyRktudFF1VDMxQVl3QTRXV2lhSWFRMEFRc0I1cW1ZOGcvNjQw?x-oss-process=image/format,png) # 1.1 Kafka集群架构 Kafka集群由多个称为代理的服务器组成,这