Scrapy安装成功,但命令startproject失败

问题一 lxml问题:

由于window7系统内安装了2.x和3.x,需要使用py -3 -m scrapy startproject;过程中出现创建项目失败:

Traceback (most recent call last):
  File "D:\Python36\lib\runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "D:\Python36\lib\runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "D:\Python36\lib\runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "D:\Python36\lib\site-packages\scrapy\__init__.py", line 34, in <module>
    from scrapy.spiders import Spider
  File "D:\Python36\lib\site-packages\scrapy\spiders\__init__.py", line 10, in <module>
    from scrapy.http import Request
  File "D:\Python36\lib\site-packages\scrapy\http\__init__.py", line 11, in <module>
    from scrapy.http.request.form import FormRequest
  File "D:\Python36\lib\site-packages\scrapy\http\request\form.py", line 11, in <module>
    import lxml.html
  File "D:\Python36\lib\site-packages\lxml\html\__init__.py", line 54, in <module>
    from .. import etree
ImportError: cannot import name 'etree'

ImportError: cannot import name ‘etree’

解决方法:

  1. py - 3 -m pip uninstall lxml 卸载原有版本lxml
  2. py -3 -m pip install lxml 重新安装系统推荐版本
  3. 推荐科学上网buff加持

问题二 cryptography问题:

Traceback (most recent call last):
  File "D:\Python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "D:\Python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\Python36\lib\site-packages\scrapy\__main__.py", line 4, in <module>
    execute()
  File "D:\Python36\lib\site-packages\scrapy\cmdline.py", line 145, in execute
    cmd.crawler_process = CrawlerProcess(settings)
  File "D:\Python36\lib\site-packages\scrapy\crawler.py", line 270, in __init__
    log_scrapy_info(self.settings)
  File "D:\Python36\lib\site-packages\scrapy\utils\log.py", line 149, in log_scrapy_info
    for name, version in scrapy_components_versions()
  File "D:\Python36\lib\site-packages\scrapy\utils\versions.py", line 35, in scrapy_components_versions
    ("pyOpenSSL", _get_openssl_version()),
  File "D:\Python36\lib\site-packages\scrapy\utils\versions.py", line 43, in _get_openssl_version
    import OpenSSL
  File "D:\Python36\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "D:\Python36\lib\site-packages\OpenSSL\crypto.py", line 12, in <module>
    from cryptography import x509
  File "D:\Python36\lib\site-packages\cryptography\x509\__init__.py", line 8, in <module>
    from cryptography.x509.base import (
  File "D:\Python36\lib\site-packages\cryptography\x509\base.py", line 16, in <module>
    from cryptography.x509.extensions import Extension, ExtensionType
  File "D:\Python36\lib\site-packages\cryptography\x509\extensions.py", line 18, in <module>
    from cryptography.hazmat.primitives import constant_time, serialization
  File "D:\Python36\lib\site-packages\cryptography\hazmat\primitives\constant_time.py", line 9, in <module>
    from cryptography.hazmat.bindings._constant_time import lib
ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。

ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。

或者

ImportError: DLL load failed: 操作系统无法运行1% 这个可能解决其它问题吧,顺便贴出来

解决方法:

  1. py - 3 -m pip I cryptography 重新安装cryptography
  2. 推荐科学上网buff加持
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值