Python报错 ImportError: DLL load failed while importing win32api: %1 不是有效的 Win32 应用程序 的解决方法
今天在用jupyter notebook 的时候发生了kernel error,点开之后提示了以下报错信息
Traceback (most recent call last):
File "C:\Users\boqia\AppData\Roaming\Python\Python38\site-packages\tornado\web.py", line 1704, in _execute
result = await result
File "C:\Users\boqia\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "E:\Anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 69, in post
model = yield maybe_future(
File "C:\Users\boqia\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\boqia\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "E:\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\Users\boqia\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\boqia\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "E:\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 100, in start_kernel_for_session
kernel_id = yield maybe_future(
File "C:\Users\boqia\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\boqia\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 234, in wrapper
yielded = ctx_run(next, result)
File "E:\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "C:\Users\boqia\AppData\Roaming\Python\Python38\site-packages\jupyter_client\multikernelmanager.py", line 185, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\boqia\AppData\Roaming\Python\Python38\site-packages\jupyter_client\manager.py", line 309, in start_kernel
kernel_cmd, kw = self.pre_start_kernel(**kw)
File "C:\Users\boqia\AppData\Roaming\Python\Python38\site-packages\jupyter_client\manager.py", line 256, in pre_start_kernel
self.write_connection_file()
File "C:\Users\boqia\AppData\Roaming\Python\Python38\site-packages\jupyter_client\connect.py", line 468, in write_connection_file
self.connection_file, cfg = write_connection_file(self.connection_file,
File "C:\Users\boqia\AppData\Roaming\Python\Python38\site-packages\jupyter_client\connect.py", line 138, in write_connection_file
with secure_write(fname) as f:
File "E:\Anaconda3\lib\contextlib.py", line 113, in __enter__
return next(self.gen)
File "C:\Users\boqia\AppData\Roaming\Python\Python38\site-packages\jupyter_core\paths.py", line 435, in secure_write
win32_restrict_file_to_user(fname)
File "C:\Users\boqia\AppData\Roaming\Python\Python38\site-packages\jupyter_core\paths.py", line 361, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed while importing win32api: %1 不是有效的 Win32 应用程序。
主要先看后两行报错信息,我们知道jupyter notebook再import win32api的时候报错了
这可能是由于python版本是64位的,但电脑中已经存在了32位的pywin32所导致的
我们在命令行中运行以下代码来卸载pywin32
pip uninstall pywin32
由于可能电脑中存在多个版本的pywin32,所以卸载完成后在运行以下代码查看时候还有没卸载的pywin32
pip show pywin32
如果返回了如下结果,则说明电脑中仍然存在pywin32
C:\Users\boqia>pip show pywin32
Name: pywin32
Version: 227
Summary: Python for Window Extensions
Home-page: https://github.com/mhammond/pywin32
Author: Mark Hammond (et al)
Author-email: mhammond@skippinet.com.au
License: PSF
Location: e:\anaconda3\lib\site-packages
Requires:
Required-by: jupyter-core, xlwings, pypiwin32
这时候我们只需要在执行一次卸载命令就行了
pip uninstall pywin32
再彻底卸载完pywin32之后,我们在使用以下命令,安装所兼容的pywin32
pip install pywin32
安装完成后,应该就不会再报错了.
Python报错 ImportError: DLL load failed while importing win32api: %1 不是有效的 Win32 应用程序 的解决方法的更多相关文章
- python——报错ImportError:DLL load failed with error code -1073741795的解决方式
python中导入一个包,import cv2总是报错'ImportError:DLL load failed with error code -1073741795',报错形式: 网上找了好久的解决 ...
- 转载:Win7系统 利用 pycharm导入Tensorflow失败,出现报错——ImportError:DLL load failed with error code -1073741795的解决方式
转载自:https://blog.csdn.net/shen123me/article/details/80621103 下面的报错信息困扰了一天,网上的各种方法也都试过了,还是失败,最后自己瞎试,把 ...
- ImportError: DLL load failed while importing win32api: 找不到指定的模块。
这个是用pip install pywin32安装报的一个错误 据说直接使用pip install pypiwin32安装就不会有报错 但是遇到错误还是要尝试解决一下的 pip install pyw ...
- 解决:ImportError: DLL load failed while importing _sqlite3: 找不到指定的模块。
Django框架学习第一步,创建一个Django工程. 本次采用的是创建虚拟环境来创建Django工程.本地解释器采用anaconda ,内置Python3.8 在pycharm中报错: 内容如下:I ...
- conda使用报错:ImportError:DLL load failed
conda安装python环境经常报: ImportError:DLL load failed 将环境变量加入path可以解决: D:\program\anaconda D:\program\anac ...
- import cx_Oracle报错,提示importError: DLL load failed: 不是有效的Win32程序。
问题说明1:WIN32,python是2.7版本,本地oracle client是32位的.import cx_Oracle报错,提示importError: DLL load failed: 该模块 ...
- ImportError: DLL load failed: 找不到指定的模块;ImportError: numpy.core.multiarray failed to import 报错解决
python程序运行出错,出错的两行主要信息如下: ImportError: DLL load failed: 找不到指定的模块 ImportError: numpy.core.multiarray ...
- 终于解决了python 3.x import cv2 “ImportError: DLL load failed: 找不到指定的模块” 及“pycharm关于cv2没有代码提示”的问题
终于解决了python 3.x import cv2 “ImportError: DLL load failed: 找不到指定的模块” 及“pycharm关于cv2没有代码提示”的问题 参考 :h ...
- python ImportError: DLL load failed: %1 不是有效的 Win32 应用程序
导入的时候报出了 ImportError 在windows上安装python 的模块后,导入模块时报 python ImportError: DLL load failed: %1 不是有效的 Win ...
随机推荐
- C#编写一个控制台应用程序,输入三角形或者长方形边长,计算其周长和面积并输出
编写一个控制台应用程序,输入三角形或者长方形边长,计算其周长和面积并输出. 代码: using System; using System.Collections.Generic; using Syst ...
- java中checked异常和unchecked异常区别?
马克-to-win:checked和unchecked异常区别:结论就是:1)RuntimeException和他的子类都是unchecked异 常.其他的都是checked异常.马克-to-win: ...
- JavaScript 中 append()、prepend()、after()、before() 的区别
内容 append().prepend().after().before() 的区别 jQuery 操作 DOM 之添加节点 方法名 作用 $(selector).append() 指定元素内部添加, ...
- python---希尔排序的实现
def shell_sort(alist): """希尔排序""" n = len(alist) gap = n // 2 # 插入算法执行 ...
- git的.gitignore文件内容
**/pom.xml.versionsBackup **/target/ **/out/ *.class # Mobile Tools for Java (J2ME) .mtj.tmp/ .idea/ ...
- 3.初识Java
一.Java特性和优势 简单性 面向对象 可移植性 高性能 分布式 动态性 多线程 安全性 健壮性 二.Java三大版本 一次编写到处运行 JavaSE:标准版(桌面程序,控制台开发) JavaME: ...
- kubeadm 搭建 K8s
kubeadm 搭建 K8s 本篇主要记录一下 使用 kubeadm 搭建 k8s 详细过程 ,环境使用 VirtualBox 构建的3台虚拟机 1.环境准备 操作系统:Centos7 (CentOS ...
- petite-vue源码剖析-逐行解读@vue-reactivity之effect
当我们通过effect将副函数向响应上下文注册后,副作用函数内访问响应式对象时即会自动收集依赖,并在相应的响应式属性发生变化后,自动触发副作用函数的执行. // ./effect.ts export ...
- Apache Hudi 如何加速传统的批处理模式?
1. 现状说明 1.1 数据湖摄取和计算过程 - 处理更新 在我们的用例中1-10% 是对历史记录的更新.当记录更新时,我们需要从之前的 updated_date 分区中删除之前的条目,并将条目添加到 ...
- busybox+linux Deplay 手机服务器
环境下载地址: Linux Deplay: https://github.com/meefik/linuxdeploy/releases Busybox : https:/ ...