Traceback (most recent call last): File “D:/程序库/python_crawler/crawler/crawler02.py“, line 9, in <

这是我学那个爬虫报的一个错,打死都找不到问题,后来解决了

Traceback (most recent call last):
  File "D:/程序库/python_crawler/crawler/crawler02.py", line 9, in <module>
    import bs4
  File "D:\Install\Python 3.5\lib\site-packages\bs4\__init__.py", line 38, in <module>
    from .builder import builder_registry, ParserRejectedMarkup
  File "D:\Install\Python 3.5\lib\site-packages\bs4\builder\__init__.py", line 7, in <module>
    from bs4.element import (
  File "D:\Install\Python 3.5\lib\site-packages\bs4\element.py", line 12, in <module>
    import soupsieve
  File "D:\Install\Python 3.5\lib\site-packages\soupsieve\__init__.py", line 29, in <module>
    from . import css_parser as cp
  File "D:\Install\Python 3.5\lib\site-packages\soupsieve\css_parser.py", line 4, in <module>
    from . import util
  File "D:\Install\Python 3.5\lib\site-packages\soupsieve\util.py", line 59
    f"'{func.__name__}' is deprecated. {message}",
                                                ^
SyntaxError: invalid syntax

Process finished with exit code 1

得装lxml这个库,装库不用我教了吧,直接pip或者pycharm装

但是装这个库我又出现了问题

Traceback (most recent call last):
  File "D:\Install\PyCharm 2020.1\plugins\python\helpers\packaging_tool.py", line 131, in main
    do_install(pkgs)
  File "D:\Install\PyCharm 2020.1\plugins\python\helpers\packaging_tool.py", line 59, in do_install
    run_pip(['install'] + pkgs)
  File "D:\Install\PyCharm 2020.1\plugins\python\helpers\packaging_tool.py", line 73, in run_pip
    runpy.run_module(module_name, run_name='__main__', alter_sys=True)
  File "D:\Install\Python 3.5\lib\runpy.py", line 182, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "D:\Install\Python 3.5\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "D:\Install\Python 3.5\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\Install\Python 3.5\lib\site-packages\pip\__main__.py", line 29, in <module>
    from pip._internal.cli.main import main as _main
  File "D:\Install\Python 3.5\lib\site-packages\pip\_internal\cli\main.py", line 57
    sys.stderr.write(f"ERROR: {exc}")
                                   ^
SyntaxError: invalid syntax

说是电脑装了多个python版本造成的,我有3,5和3.8的,后来换成3.8的就没问题了,真是晕

来源:陈无忧cy

物联沃分享整理
物联沃-IOTWORD物联网 » Traceback (most recent call last): File “D:/程序库/python_crawler/crawler/crawler02.py“, line 9, in <

发表评论