尝试使用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.
答案 0 :(得分:1)
以防万一其他人来到这里,这对我有用:在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中,就可以了
答案 1 :(得分:0)
确保安装了与Python安装相匹配的正确库。如果您正在运行Python 32位,请安装库的32位版本。如果您是Python x64,请安装该库的x64版本。这是导致此错误的最常见原因。
答案 2 :(得分:0)
我遇到了同样的问题,并在https://github.com/scrapy/scrapy/issues/3447找到了解决方法
conda update -n base conda
事实证明,该错误仅在PyCharm内部发生,解决方案是根据https://github.com/conda/conda/issues/8046#issuecomment-450515815
安装OpenSSL答案 3 :(得分:-1)
对我来说,问题是我的python版本。从python 3.7.2切换到3.7.1修复了该问题