[英]How to fix Jupyter Notebook pandas error (OSError: [WinError 193] %1 is not a valid Win32 application)
I am currently working on the Yelp regression project in a Machine Learning course.我目前正在机器学习课程中从事 Yelp 回归项目。
The project requires me to open a Jupyter notebook and import pandas as py.该项目要求我打开一个 Jupyter notebook 并将 Pandas 导入为 py。
I use the Anaconda navigator to open Jupyter notebook.我使用 Anaconda 导航器打开 Jupyter 笔记本。 I get the following:
我得到以下信息:
(OSError: [WinError 193] %1 is not a valid Win32 application)
(OSError: [WinError 193] %1 不是有效的 Win32 应用程序)
when I try to import pandas for my code.当我尝试为我的代码导入熊猫时。 The full message:
完整信息:
OSError Traceback (most recent call last)
<ipython-input-2-ed70324e10b6> in <module>
----> 1 import pandas as pd
2
3
businesses = pd.read_json('yelp_business.json', lines = True)
4 reviews = pd.read_json('yelp_review.json', lines = True)
5 users = pd.read_json('yelp_user.json', lines = True)
~\AppData\Roaming\Python\Python37\site-packages\pandas\__init__.py in <module>
9 for dependency in hard_dependencies:
10 try:
---> 11 __import__(dependency)
12 except ImportError as e:
13 missing_dependencies.append("{0}: {1}".format(dependency, str(e)))
~\AppData\Roaming\Python\Python37\site-packages\numpy\__init__.py in <module>
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 <module>
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:
~\Anaconda3\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
354
355 if handle is None:
--> 356 self._handle = _dlopen(self._name, mode)
357 else:
358 self._handle = handle
OSError: [WinError 193] %1 is not a valid Win32 application
I've already tried uninstalling and installing python, anaconda, and pandas.我已经尝试卸载和安装 python、anaconda 和 pandas。
You probably downloaded the 64-bit pandas on a 32-bit system.您可能在 32 位系统上下载了 64 位 Pandas。 Uninstall and reinstall but pay extra attention to this.
卸载并重新安装,但要特别注意这一点。
lt is likely that your environment is messed up.很可能你的环境搞砸了。 As you can see from the traceback, there are two python environments involved here:
从回溯中可以看出,这里涉及到两个 python 环境:
C:\\Users\\nouma\\AppData\\Roaming\\Python\\Python37
C:\\Users\\nouma\\Anaconda3
Please make sure your PATH
is clean and you can actually remove one of them first.请确保您的
PATH
是干净的,并且您可以先删除其中一个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.