文章目录

  • 前言
  • 一、ModuleNotFoundError: No module named 'sklearn'
  • 二、ImportError: cannot import name 'show_config' from 'numpy' (unknown location)
  • 三、Pycharm报错:“Original error was: DLL load failed: 找不到指定的模块“ 的解决办法
  • 四、ImportError: cannot import name '_imaging' from 'PIL'ImportError: cannot import name '_imaging' from 'PIL'
  • 五、ImportError: bad magic number in 'vlib.layers': b'\x03\xf3\r\n'
  • 六、AttributeError: module ‘backend_interagg‘ has no attribute ‘FigureCanvas‘的解决办法
  • 七、WARNING: Skipping D:\1Python_text\Anaconda3\envs\jupter_huan\Lib\site-packages\numpy-1.21.6.dist-info due to invalid metadata entry 'name'
  • 八、AttributeError: 'NoneType' object has no attribute 'split'
  • 九、TypeError: warn() missing 1 required keyword-only argument: 'stacklevel'
  • 十、ImportError: cannot import name 'if_delegate_has_method' from 'sklearn.utils.metaestimators' (D:\1Python_text\Anaconda3\envs\mmd\lib\site-packages\sklearn\utils\metaestimators.py)
  • 十一、Python错误:AttributeError: module ‘tensorflow’ has no attribute ‘Session’
  • 十二、ModuleNotFoundError: No module named '_distutils_hack'
  • 十三、Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly
  • 十四、ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly
  • 十五、ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects
  • 十六、ModuleNotFoundError: No module named ‘tensorflow.contrib‘
  • 十七、AttributeError: module 'wandb' has no attribute 'init'
  • 十八、CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-32/current_repodata.json>
  • 十九、'tuple' object has no attribute 'size'
  • 二十、 UserWarning: CUDA initialization: CUDA unknown error - this may be due to an incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start. Setting the available devices to be zero. (Triggered internally at /opt/conda/conda-bld/pytorch_1614378083779/work/c10/cuda/CUDAFunctions.cpp:109.)
  • 二十一、ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conf licts. torchaudio 2.4.1 requires torch ==2.4.1, but you have torch 2.0.0+cu118 which is incompatible. torchvision 0.19.1 requires torch ==2.4.1, but you have torch 2.0.0+cu118 which is incompatible.


前言

以下介绍初学者运行Pycharm程序可能会出现的问题,及解决办法。


一、ModuleNotFoundError: No module named ‘sklearn’

问题概括: Python 运行时提示找不到’sklearn’ 模块,说明系统未安装 scikit-learn 库。出现ModuleNotFoundError类似的错误,都是缺少库,安装引号内的库即可。部分库的名称和引号提示的名称不一致,例子的报错是’sklearn’,但安装的是scikit-learn。常见名称不一致的库如图1所示。

解决方案: 使用包管理器安装 scikit-learn,若用 pip 则执行pip install scikit-learn,若用 conda 则执行conda install scikit-learn。可在两个地方进行安装,如图2,图3。(注:安装库的前提是已经创建好虚拟环境,并把虚拟环境连接 PyCharm中。如果没进行这两步,可依次点击下面链接进行操作。)
创建虚拟环境
虚拟环境连接 PyCharm
图1

图1常见名称不一致的库

在这里插入图片描述

图2 pycharm中安装库

在这里插入图片描述

图3 Anaconda Prompt (ANaconda 3)中安装库

二、ImportError: cannot import name ‘show_config’ from ‘numpy’ (unknown location)

问题概括: 原因报错是由于Scipy与Numpy版本不兼容导致的,一般是由于Scipy版本过高,而Numpy版本过低。
Scipy 1.1.0 + Numpy 1.15.0 版本完全兼容

pip uninstall numpy
pip install numpy==1.15.0

三、Pycharm报错:“Original error was: DLL load failed: 找不到指定的模块“ 的解决办法

打开Anaconda prompt–-conda activate +你的虚拟环境名

pip uninstall -y numpy
pip uninstall -y setuptools
pip install setuptools
pip install numpy

四、ImportError: cannot import name ‘_imaging’ from 'PIL’ImportError: cannot import name ‘_imaging’ from ‘PIL’

卸载:pip uninstall Pillow
重装:pip uninstall Pillow

五、ImportError: bad magic number in ‘vlib.layers’: b’\x03\xf3\r\n’

解决办法:删除项目中所有的 .pyc 文件。

六、AttributeError: module ‘backend_interagg‘ has no attribute ‘FigureCanvas‘的解决办法

加入:

import matplotlib
matplotlib.use('TkAgg')

七、WARNING: Skipping D:\1Python_text\Anaconda3\envs\jupter_huan\Lib\site-packages\numpy-1.21.6.dist-info due to invalid metadata entry ‘name’

删除路径上numpy-1.21.6.dist-info文件夹

八、AttributeError: ‘NoneType’ object has no attribute ‘split’

应该是numpy的包出现问题,需要重新安装numpy+mkl

九、TypeError: warn() missing 1 required keyword-only argument: ‘stacklevel’

pip uninstall traitlets
pip install traitlets==5.9.0

十、ImportError: cannot import name ‘if_delegate_has_method’ from ‘sklearn.utils.metaestimators’ (D:\1Python_text\Anaconda3\envs\mmd\lib\site-packages\sklearn\utils\metaestimators.py)

pip install --user scikit-learn==0.23.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

十一、Python错误:AttributeError: module ‘tensorflow’ has no attribute ‘Session’

import tensorflow.compat.v1 as tf

十二、ModuleNotFoundError: No module named ‘_distutils_hack’

使用记事本或者sublime Text等软件打开/home/user/anaconda3/envs/SWINTS/lib/python3.8/site-packages/distutils-precedence.pth这个文件,在该文件的import os;后边敲击一个回车键,然后保存即可。

十三、Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

conda install py-opencv

十四、ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

pip install --upgrade pip

十五、ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects

pip install -i https://pypi.douban.com/simple/ pip install opencv-python==4.3.0.38

十六、ModuleNotFoundError: No module named ‘tensorflow.contrib‘

出现 “ModuleNotFoundError: No module named ‘tensorflow.contrib’” 错误通常是因为在 TensorFlow 2.0 版本中,tensorflow.contrib 模块已被移除。使用tensorfolw.1.xhttps://blog.csdn.net/weixin_

十七、AttributeError: module ‘wandb’ has no attribute ‘init’

pip install wandb

十八、CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://repo.anaconda.com/pkgs/main/win-32/current_repodata.json

Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.

SSLError(MaxRetryError(‘HTTPSConnectionPool(host=‘repo.anaconda.com’, port=443): Max retries exceeded with url: /pkgs/main/win-32/current_repodata.json (Caused by SSLError(SSLError(“bad handshake: Error([(‘SSL routines’, ‘ssl3_
get_server_certificate’, ‘certificate verify failed’)],)”,),))’,),)

解决方法参考

十九、‘tuple’ object has no attribute ‘size’

pip install torch-summary

二十、 UserWarning: CUDA initialization: CUDA unknown error - this may be due to an incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start. Setting the available devices to be zero. (Triggered internally at /opt/conda/conda-bld/pytorch_1614378083779/work/c10/cuda/CUDAFunctions.cpp:109.)

win+r打开运行,输入devmgmt.msc打开设备管理器
向下拉直到展开显示适配器,右键单击第二项
点击启用设备即可打开GPU

二十一、ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conf licts. torchaudio 2.4.1 requires torch ==2.4.1, but you have torch 2.0.0+cu118 which is incompatible. torchvision 0.19.1 requires torch ==2.4.1, but you have torch 2.0.0+cu118 which is incompatible.

解决PyTorch相关库的版本冲突问题
即torch版本高,而torchvision torchaudio低的问题,安装制定版本的

pip install torchvision == 0.15.1  torchaudio ==2.0.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/diannao/86960.shtml
繁体地址,请注明出处:http://hk.pswp.cn/diannao/86960.shtml
英文地址,请注明出处:http://en.pswp.cn/diannao/86960.shtml

如若内容造成侵权/违法违规/事实不符,请联系英文站点网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Android开发中的Java与Kotlin:全面对比与深度解析

Android开发中的Java与Kotlin&#xff1a;全面对比与深度解析 在Android开发领域&#xff0c;Java和Kotlin是两种主流编程语言。自Google在2017年宣布Kotlin为Android官方支持语言以来&#xff0c;Kotlin凭借其现代语法特性和与Java的无缝兼容性&#xff0c;逐渐成为开发者的新…

为应对激烈竞争环境,IBMS系统如何提升企业管理效率

IBMS智能管理系统&#xff1a;赋能企业高效运营&#xff0c;决胜竞争新时代 在瞬息万变的商业环境中&#xff0c;效率就是竞争力&#xff01;企业如何快速响应市场变化、优化内部流程、降低成本并实现精准决策&#xff1f;IBMS智能管理系统以创新科技为引擎&#xff0c;为企业…

2.3 ASPICE的架构与设计

在ASPICE中&#xff0c;架构与设计是汽车软件开发过程中非常重要的一环&#xff0c;它涉及到定义和设计软件系统的整体结构、组件以及其相互关系。良好的架构与设计可以帮助团队更好地理解和管理软件系统&#xff0c;提高系统的可维护性、可扩展性和性能。以下是ASPICE中架构与…

生益PCB耐高温PCB板材怎么样?

在5G基站昼夜不停地吞吐数据时&#xff0c;在新能源汽车电池管理系统经受极寒酷暑考验时&#xff0c;在航空航天器穿越大气层承受2000℃热浪冲击时&#xff0c;一块优质PCB板材的“抗热基因”正在决定着整个系统的生死存亡。生益科技研发的耐高温PCB板材&#xff0c;正是在这场…

Java Spring ApplicationEvent 概述

一、Spring 事件机制核心概念 1. 事件驱动架构模型 发布-订阅模式&#xff1a;解耦事件生产者和消费者观察者模式&#xff1a;监听器监听特定事件事件驱动优势&#xff1a; 组件间松耦合系统扩展性好支持异步处理事件溯源支持 2. 核心组件 组件作用实现方式ApplicationEve…

Spring核心框架完全指南 - 基础知识全解析

📖 目录 🌟 Spring框架简介 🏗️ IoC容器详解 💉 依赖注入(DI)深入理解 ⚙️ Bean配置与管理 🎯 Bean的作用域 🔄 Bean生命周期 🎭 面向切面编程(AOP) 📝 Spring注解详解 📁 资源管理 📢 事件机制 🔤 SpEL表达式语言 🎯 实战案例 📚 总…

Parasoft C++Test软件集成测试(部件测试)_操作指南

系列文章目录 Parasoft C++Test软件静态分析:操作指南(编码规范、质量度量)、常见问题及处理 Parasoft C++Test软件单元测试:操作指南、实例讲解、常见问题及处理 Parasoft C++Test软件集成测试:操作指南、实例讲解、常见问题及处理 进阶扩展:自动生成静态分析文档、自动…

聊一聊 Linux 上对函数进行 hook 的两种方式

一&#xff1a;背景 1. 讲故事 前两篇我们介绍了 Minhook 在 Windows 平台上的强大功效&#xff0c;这一篇我们来聊一聊如何在 Linux 上对函数进行hook&#xff0c;这里介绍两种方式。 轻量级的 LD_PRELOAD 拦截 LD_PRELOAD是一种共享库拦截&#xff0c;这种方式的优点在于…

【免费分享】GWO-BP-AdaBoost预测!灰狼优化、人工神经网络与AdaBoost集成学习算法预测研究

一、模型组成原理 1. 灰狼优化算法&#xff08;GWO&#xff09; 核心思想&#xff1a;模拟灰狼群体的社会等级和狩猎行为&#xff08;包围、跟踪、攻击猎物&#xff09;&#xff0c;通过α、β、δ三级领导层引导种群搜索最优解。算法流程包括&#xff1a; 社会分层&#xff…

matlab实现非线性Granger因果检验

matlab程序包。用于格兰杰因果分析&#xff0c;分析数据时&#xff0c;直接带入数据即可。 hjt2/README , 1804 hjt2/c-code/Makefile , 57 hjt2/c-code/hjt2_tval.c , 10862 hjt2/matlab/spx_rp.dat , 175202 hjt2/matlab/spx_ur.dat , 174522 hjt2/matlab/spx_uv.dat , 1745…

从SQL Server到分布式大数据平台:重构企业数据架构

在企业数字化加速的背景下&#xff0c;越来越多的组织开始意识到&#xff1a;传统的数据系统正逐渐成为增长的“瓶颈”而非“助力”。其中&#xff0c;SQL Server 作为许多企业IT架构中曾经的中坚力量&#xff0c;正面临前所未有的挑战。它曾以稳定、易用、成本可控等优势&…

【网关】互联网公司的接入网关和业务网关怎么设计

网关 网关基础知识 RGW全称 Red GateWay :小红书网关&#xff08;网关英文&#xff1a;Gateway&#xff1b; 接入网关&#xff1a;Access Gateway&#xff09; 网关&#xff08;通用&#xff09;&#xff1a;Gateway 接入网关&#xff1a;API Gateway、Access Gateway 业务网关…

安全虚拟磁盘技术的创新与实践

文章目录 前言一、数据安全保护的新挑战1. 数据安全态势日益严峻&#xff0c;法律法规陆续出台2. 加强数据安全管控成为银行数据安全管理核心之一3. 银行终端数据安全管控存在的难题 二、安全虚拟磁盘的探索与实践1. 敏感文件的入盘及操作2. 敏感文件的流转及出盘三、安全虚拟磁…

uni-app项目实战笔记4--使用组件具名插槽slot定义公共标题模块

先来看效果&#xff1a; 如图&#xff0c;“每日推荐”&#xff0c;“专题精选”这些公共标题有相同的地方&#xff0c;也有自己的独特的地方&#xff0c;像这类有共性又有个性的可考虑使用slot插槽来实现。 实现步骤&#xff1a; 1.在前面文章创建的公共组件common-title定义…

Appium + Java 测试全流程

💖亲爱的技术爱好者们,热烈欢迎来到 Kant2048 的博客!我是 Thomas Kant,很开心能在CSDN上与你们相遇~💖 本博客的精华专栏: 【自动化测试】

vue3 双容器自动扩展布局 根据 内容的多少 动态定义宽度

需求&#xff1a; 左右两个列表 挨着排列&#xff0c;当左边内容超出滚动条时&#xff0c;换列显示&#xff0c;右边的列表随之移动 效果图&#xff1a; 1.左边数据&#xff1a;10&#xff0c;右边数据&#xff1a;5 2.左边数据&#xff1a;30&#xff0c;右边数据&#xff…

linux-java部署

version: 3 services:nacos_host:image: nacos/nacos-server:v2.2.0restart: alwayscontainer_name: nacos_hostenvironment:- MODEstandalone- PREFER_HOST_MODEhostnamevolumes:- ./sores/nacos/log:/home/nacos/logsports:- 8848:8848- 9848:9848 #2.0新增了两个端口&#x…

010502管道符_防火墙出入站_不回显带外-渗透命令-基础入门-网络安全

文章目录 1 管道符2 防火墙出入站3 不回显外带典型场景常见OOB通道实现示例&#xff08;以DNS为例&#xff09;1. 利用DNS外带数据2. 使用工具监听 防御建议扩展&#xff1a;无回显OOB自动化工具注意事项演示结语 1 管道符 | &#xff08;管道符号&#xff09; ||&#xff08;…

智慧养老与数字健康:科技赋能老年生活,构建全方位养老体系

在全球人口老龄化进程不断加速的当下&#xff0c;我国的老龄化程度也日益加深。 截至 2023 年末&#xff0c;我国 60 岁及以上人口达 2.97 亿人&#xff0c;占总人口的 21.1%&#xff0c;其中 65 岁及以上人口为 2.17 亿人&#xff0c;占总人口的 15.4%。 养老问题已成为全社…

在 cuda 基础环境中安装完整的cupy

nvidia/cuda:12.6.3-cudnn-devel-ubuntu22.04 1. 创建 cuda 基础容器 export NUM2 && \ sudo docker run --gpus all -it \ --name cupy_LHL_${NUM} \ -v /home/jimmy/ex_cupy/tmp${NUM}:/root/tmp${NUM} \ -v /home/jimmy/.ssh:/root/.ssh \ nvidia/cuda:12.6.3-dev…