New scrapy project reported an error

after successfully installing scrapy and dependency packages under windows:

C:\Users\daming\Desktop\scrapy>scrapy
Scrapy 1.5.1 - no active project

Usage:
  scrapy <command> [options] [args]

Available commands:
  bench         Run quick benchmark test
  fetch         Fetch a URL using the Scrapy downloader
  genspider     Generate new spider using pre-defined templates
  runspider     Run a self-contained spider (without creating a project)
  settings      Get settings values
  shell         Interactive scraping console
  startproject  Create new project
  version       Print Scrapy version
  view          Open URL in browser, as seen by Scrapy

  [ more ]      More commands available when run from project directory

Use "scrapy <command> -h" to see more info about a command

but the following error occurred when trying to run scrapy startproject demo:

C:\Users\daming\Desktop\scrapy>scrapy startproject demo
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\scrapy.exe\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\scrapy\cmdline.py", line 149, in execute
    cmd.crawler_process = CrawlerProcess(settings)
  File "c:\python27\lib\site-packages\scrapy\crawler.py", line 252, in __init__
    log_scrapy_info(self.settings)
  File "c:\python27\lib\site-packages\scrapy\utils\log.py", line 149, in log_scrapy_info
    for name, version in scrapy_components_versions()
  File "c:\python27\lib\site-packages\scrapy\utils\versions.py", line 35, in scrapy_components_versions
    ("pyOpenSSL", _get_openssl_version()),
  File "c:\python27\lib\site-packages\scrapy\utils\versions.py", line 43, in _get_openssl_version
    import OpenSSL
  File "c:\python27\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "c:\python27\lib\site-packages\OpenSSL\crypto.py", line 12, in <module>
    from cryptography import x509
  File "c:\python27\lib\site-packages\cryptography\x509\__init__.py", line 7, in <module>
    from cryptography.x509 import certificate_transparency
ImportError: cannot import name certificate_transparency

ask for the boss"s answer

Apr.19,2022

try reinstalling pip install cryptography


reinstall three steps:

1, reinstall sub-module
2, reinstall module
3, reinstall Python

four steps to update (don't try to update Python2 to Python3)

1, update sub-module
2, update module
3, update pip
4, update Python

= =

first of all, unless the Python environment is broken, runpy.py will not make mistakes,
and then unless the module is broken, scrapy can work normally.
but through the "three steps" and "four steps" show that this situation can not happen.
basically, it is the problem that the sub-module is not installed (not updated, not fully installed).

= =

scrapy's execution file (executable file) may not run on your version of Windows.
may also be a firewall problem. (do not allow scrapy's server to pass)
take the liberty of asking, I often have problems with the Python3,OpenSSL module. Have you mentioned OpenSSL in your error code? is it possible that the dependent library is not installed?

= =

Python2 is still unknown to me. I hope the landlord will adopt it and have some new ideas:
can you use IDLE to write Scrapy programs?
if you can, use IDLE to make it up.
if not, there are a lot of better people on the Internet than me, and they may have a solution.
can you use other modules that are based on Scrapy or have the same dependent libraries as Scrapy?
if not, try completely to reinstall the module, including submodules.

Menu