在 Anaconda 中设置第二个 Python 环境后,导入基本包失败并显示 [WinError 193] %1 is not a valid Win32 application
After setting up a second Python environment in Anaconda, importing basic packages fails with [WinError 193] %1 is not a valid Win32 application
我想要第二个环境 Python 3.6 和 Tensorflow-GPU v1.15(我的另一个环境是 Python 3.7/TF2.0)。我使用 Anaconda 提示符创建了环境并在那里安装了软件包。当我尝试在 Jupyter Notebook 中导入 pandas 或 numpy 时,它说:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-1-38d4b0363d82> in <module>
----> 1 import pandas
C:\ProgramData\Anaconda3\envs\tf1\lib\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(f"{dependency}: {e}")
~\AppData\Roaming\Python\Python36\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\Python36\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:
C:\ProgramData\Anaconda3\envs\tf1\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
346
347 if handle is None:
--> 348 self._handle = _dlopen(self._name, mode)
349 else:
350 self._handle = handle
OSError: [WinError 193] %1 is not a valid Win32 application
我已经多次尝试卸载/重新安装环境,但均未成功。 github post 对其他人的问题建议确保 PATH 是干净的,但我不确定它是什么意思。我在 Windows 10。
删除C:\Users[me]\AppData\Roaming\Python
的内容解决
我想要第二个环境 Python 3.6 和 Tensorflow-GPU v1.15(我的另一个环境是 Python 3.7/TF2.0)。我使用 Anaconda 提示符创建了环境并在那里安装了软件包。当我尝试在 Jupyter Notebook 中导入 pandas 或 numpy 时,它说:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-1-38d4b0363d82> in <module>
----> 1 import pandas
C:\ProgramData\Anaconda3\envs\tf1\lib\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(f"{dependency}: {e}")
~\AppData\Roaming\Python\Python36\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\Python36\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:
C:\ProgramData\Anaconda3\envs\tf1\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
346
347 if handle is None:
--> 348 self._handle = _dlopen(self._name, mode)
349 else:
350 self._handle = handle
OSError: [WinError 193] %1 is not a valid Win32 application
我已经多次尝试卸载/重新安装环境,但均未成功。 github post 对其他人的问题建议确保 PATH 是干净的,但我不确定它是什么意思。我在 Windows 10。
删除C:\Users[me]\AppData\Roaming\Python
的内容解决