首页 > 解决方案 > 与 anaconda 和 python 库相关的问题

问题描述

每次我在 jupyter 中导入任何库都会显示这种类型的错误,我使用的是 64 位窗口操作系统。

OSError Traceback (most recent call last) in ----> 1 import pandas as pd 2 digit = pd.read_csv(r'E:\ML_Codes\all\train.csv')

~\AppData\Roaming\Python\Python37\site-packages\pandas__init__.py in 9 for dependency in hard_dependencies: 10 try: ---> 11 import(dependency) 12 except ImportError as e: 13 missing_dependencies.append(f"{dependency}: {e}")

~\AppData\Roaming\Python\Python3.7\site-packages\numpy__init__.py in 138 139 # Allow distributors to run custom init code --> 140 from . import _distributor_init 141 142 from . import core

~\AppData\Roaming\Python\Python37\site-packages\numpy_distributor_init.py in 24 # NOTE: would it change behavior to load ALL 25 # DLLs at this path vs. the name restriction? ---> 26 WinDLL(os.path.abspath(filename)) 27 DLL_filenames.append(filename) 28 if len(DLL_filenames) > 1:

C:\anacondanewww\lib\ctypes__init__.py in init(self, name, mode, handle, use_errno, use_last_error) 362 363 if handle is None: --> 364 self._handle = _dlopen(self._name, mode) 365 else: 366 self._handle = handle

OSError: [WinError 193] %1 is not a valid Win32 application

标签: pythonpython-3.xwindowsjupyter-notebookanaconda

解决方案


从查看错误消息来看,似乎存在某种依赖问题,这是我相信的一些奇怪的安装错误导致的。

对于最简单的解决方案,我建议删除所有 Python3.x 实例并删除文件夹(对安装 anaconda 执行相同操作),然后重新安装 anaconda,然后尝试

可能出错的第二件事是,在运行 Jupyter 笔记本时,您可能没有使用安装了 pandas 库的正确 python 版本。看看在它提到 Python 的右上角是否有多个选项可供选择您需要选择的版本。


推荐阅读