python - 与 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
解决方案
从查看错误消息来看,似乎存在某种依赖问题,这是我相信的一些奇怪的安装错误导致的。
对于最简单的解决方案,我建议删除所有 Python3.x 实例并删除文件夹(对安装 anaconda 执行相同操作),然后重新安装 anaconda,然后尝试
可能出错的第二件事是,在运行 Jupyter 笔记本时,您可能没有使用安装了 pandas 库的正确 python 版本。看看在它提到 Python 的右上角是否有多个选项可供选择您需要选择的版本。
推荐阅读
- python - 如何为每个列表项制作包含列表和字典的 CSV 文件?
- c - 读取 PE COFF Header 并获取特征标志
- python - 如何去除Series中的空列表,同时将非空列表变为字符串形式?
- javascript - 使用铬浏览器录制画布动画播放问题
- c# - 异步方法 MVS AJAX WCF 不异步?
- apache-kafka - 如何在 Kafka 源连接器(例如 Debezium)中禁用 JSON 模式
- python - 如何使用 python 将两位数分隔为两位数?例如 15 -> 1, 5
- sql-server - 在PowerShell中调用具有多个参数的存储过程
- reactjs - 无法使用反应测试库从侧面菜单中单击列表子元素
- python - 识别 json 文件中项目的位置