Python 在Windows 10(64位)计算机上使用Spyder导入Matplotlib时,为什么会出现winError 193?
我正在使用Windows 10(64位)计算机,并已安装Anaconda。我试图在Spyder中执行这行代码:Python 在Windows 10(64位)计算机上使用Spyder导入Matplotlib时,为什么会出现winError 193?,python,numpy,matplotlib,anaconda,Python,Numpy,Matplotlib,Anaconda,我正在使用Windows 10(64位)计算机,并已安装Anaconda。我试图在Spyder中执行这行代码: import matplotlib.pyplot as plt 但是,我得到了这个错误: --------------------------------------------------------------------------- OSError Traceback (most recent call l
import matplotlib.pyplot as plt
但是,我得到了这个错误:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-1-7b260cc15e44> in <module>
----> 1 import matplotlib.pyplot as plt
~\AppData\Roaming\Python\Python37\site-packages\matplotlib\__init__.py in <module>
139 # cbook must import matplotlib only within function
140 # definitions, so it is safe to import from it here.
--> 141 from . import cbook, rcsetup
142 from matplotlib.cbook import (
143 MatplotlibDeprecationWarning, dedent, get_label, sanitize_sequence)
~\AppData\Roaming\Python\Python37\site-packages\matplotlib\cbook\__init__.py in <module>
31 from weakref import WeakMethod
32
---> 33 import numpy as np
34
35 import matplotlib
~\AppData\Roaming\Python\Python37\site-packages\numpy\__init__.py in <module>
140 from . import _distributor_init
141
--> 142 from . import core
143 from .core import *
144 from . import compat
~\AppData\Roaming\Python\Python37\site-packages\numpy\core\__init__.py in <module>
21 # NOTE: would it change behavior to load ALL
22 # DLLs at this path vs. the name restriction?
---> 23 WinDLL(os.path.abspath(filename))
24 DLL_filenames.append(filename)
25 if len(DLL_filenames) > 1:
~\Anaconda3\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
---------------------------------------------------------------------------
OSError回溯(最近一次调用上次)
在里面
---->1将matplotlib.pyplot作为plt导入
中的~\AppData\Roaming\Python\Python37\site packages\matplotlib\\uuuuu init\uuuuuu.py
139#cbook必须仅在函数中导入matplotlib
140#定义,因此从这里导入是安全的。
-->141来自。导入cbook、rcsetup
142从matplotlib.cbook导入(
143 MatplotlibDeprecationWarning、dedent、get_标签、sanitize_序列)
中的~\AppData\Roaming\Python\Python37\site packages\matplotlib\cbook\\uuuuu init\uuuuuu.py
31来自weakref进口WeakMethod
32
--->33进口numpy作为np
34
35导入matplotlib
中的~\AppData\Roaming\Python\Python37\site packages\numpy\\uuuu init\uuuuuu.py
140美元。导入\u分发服务器\u初始化
141
-->142来自。导入核心
143.核心进口*
144来自。进口同胞
中的~\AppData\Roaming\Python\Python37\site packages\numpy\core\\uuuuu init\uuuuuu.py
21#注意:加载所有
22#此路径上的DLL与名称限制?
--->23 Windell(os.path.abspath(文件名))
24 DLL_文件名。追加(文件名)
25如果len(DLL_文件名)>1:
~\Anaconda3\lib\ctypes\\uuuuu init\uuuuu.py in\uuuuu init\uuuu(self、name、mode、handle、use\u errno、use\u last\u error)
362
363如果句柄为“无”:
-->364 self.\u handle=\u dlopen(self.\u名称,模式)
365其他:
366自.\u手柄=手柄
OSError:[WinError 193]%1不是有效的Win32应用程序
我试着在Jupyter笔记本和Anaconda Shell中直接导入matplotlib。但是,我到处都会遇到同样的错误。欢迎使用SO。我们都为一个问题创建了一个帐户。你的很难!1.你确定你使用的是anaconda的python3
import sys;打印系统可执行文件
。2.只需导入numpy
即可减少您的问题。以及3/重新安装numpy:pip安装--升级--强制重新安装numpy
。欢迎使用SO。我们都为一个问题创建了一个帐户。你的很难!1.你确定你使用的是anaconda的python3import sys;打印系统可执行文件
。2.只需导入numpy
即可减少您的问题。井3/重新安装numpy:pip安装--升级--强制重新安装numpy
。