1

尝试使用 scrapy 命令创建文件夹时出现以下问题。我尝试搜索此问题并在https://groups.google.com/forum/#!topic/scrapy-users/8N6V_OGUqtI找到了解决方案 我尝试了那里提供的步骤,但仍然遇到此问题。

解决此问题的任何帮助将不胜感激。

(C:\Users\dell\Anaconda3) C:\Users\dell>activate scrapy-env

(scrapy-env) C:\Users\dell>scrapy startproject tutorial
Traceback (most recent call last):
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\Scripts\scrapy-script.py", line 5, in <module>
    sys.exit(scrapy.cmdline.execute())
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\scrapy\cmdline.py", line 128, in execute
    cmds = _get_commands_dict(settings, inproject)
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\scrapy\cmdline.py", line 46, in _get_commands_dict
    cmds = _get_commands_from_module('scrapy.commands', inproject)
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\scrapy\cmdline.py", line 29, in _get_commands_from_module
    for cmd in _iter_command_classes(module):
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\scrapy\cmdline.py", line 19, in _iter_command_classes
    for module in walk_modules(module_name):
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\scrapy\utils\misc.py", line 71, in walk_modules
    submod = import_module(fullpath)
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\scrapy\commands\version.py", line 6, in <module>
    import OpenSSL
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\OpenSSL\rand.py", line 10, in <module>
    from OpenSSL._util import (
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\OpenSSL\_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "C:\Users\dell\Anaconda3\envs\scrapy-env\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 13, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: DLL load failed: The operating system cannot run %1.
4

3 回答 3

2

以防万一其他人在这里结束,这对我有用:我在从 anaconda 提示符运行 scrapy 时遇到了同样的错误。通过在进程监视器上查看,在 Anaconda3\Lib\site-packages\cryptography\hazmat\bindings 中找不到这两个 dll 文件引起的。将两个文件从 Anaconda3\pkgs\openssl-1.0.2o-h8ea7d77_0\Library\bin 复制到 Anaconda3\Lib\site-packages\cryptography\hazmat\bindings,它就可以工作了

于 2018-08-12T22:58:38.667 回答
1

我遇到了同样的问题,并在https://github.com/scrapy/scrapy/issues/3447找到了解决方案

conda update -n base conda

事实证明,该错误仅发生在 PyCharm 中,解决方案是根据https://github.com/conda/conda/issues/8046#issuecomment-450515815安装 OpenSSL

于 2019-04-04T16:32:21.450 回答
0

确保您安装了与您的 Python 安装相匹配的正确库。如果您正在运行 Python 32 位,请安装库的 32 位版本。如果您是 Python x64,请安装 x64 版本的库。这是导致此错误的最常见原因。

于 2017-11-07T17:48:27.840 回答