【问题标题】:How to install spacy and avoid 32/64 bit error?如何安装 spacy 并避免 32/64 位错误?
【发布时间】:2019-11-11 00:57:19
【问题描述】:

我试图执行

pip install spacy

它终于与 Python 3.7 64 位(不是 32 位版本)一起工作,但安装后没有其他包导入,如 pandas 正在工作。看来安装是根本原因,但是去掉spacy后pandas和很多其他包的导入错误还是一样。

重新安装python后(我总是直接安装在文件夹C:\Python中), 我可以成功安装 pandas 和所有其他软件包而不会出现以下错误,但我仍然无法使用 Spacy,因为我会收到导入错误:

OSError: [WinError 193] %1 不是有效的 Win32 应用程序

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-1-7dd3504c366f> in <module>
----> 1 import pandas as pd

c:\python\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("{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:

c:\python\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 ist keine zulässige Win32-Anwendung´´´



【问题讨论】:

  • 你认为你可以翻译错误信息吗?
  • 是的:“%1 不是有效的 win32 应用程序”。

标签: python nlp spacy


【解决方案1】:

您目前有两个不同的 site-package 文件夹,从中导入包:

c:\python\lib\site-packages

~\AppData\Roaming\Python\Python37\site-packages

在我看来,您的系统上当前混合了不同的 python 安装,或者是以前安装的残留版本,然后是不完全删除的版本。因此,我建议:

  1. 删除所有 python 安装
  2. 完全删除c:\python~\AppData\Roaming\Python
  3. 仅重新安装一个 python 发行版。如果您不在乎使用哪个版本,请选择 64 位版本

【讨论】:

  • 非常感谢!你的回答解决了我的问题。此外,我现在有一个全新的单一 python 环境。
猜你喜欢
  • 2020-05-22
  • 2017-08-26
  • 2012-08-01
  • 2014-01-20
  • 2014-07-21
  • 2014-01-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多