我使用scrapy 1.5.1
在windows 8.1
上安装了conda 4.5.11
,
conda install -c conda-forge scrapy
我正在运行Pycharm:
PyCharm 2018.2.4 (Professional Edition)
Build #PY-182.4505.26, built on September 19, 2018
JRE: 1.8.0_152-release-1248-b8 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 8.1 6.3
我已将项目解释器设置为anaconda的python:
此外,我已经设置了调试配置,并将工作目录指向我的Spider的项目目录:
我在Spiders代码中设置了一个断点。但是,当我按debug时,控制台输出会出现以下错误:
"C:\Program Files\Python36\python.exe" "C:\Program Files\JetBrains\PyCharm 2018.2.4\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 54316 --file "C:/Program Files/Anaconda3/Scripts/scrapy.exe" crawl btctalkSpider -o items.csv
pydev debugger: process 632 is connecting
Connected to pydev debugger (build 182.4505.26)
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\tokenize.py", line 390, in find_cookie
line_string = line.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 2: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2018.2.4\helpers\pydev\pydevd.py", line 1664, in <module>
main()
File "C:\Program Files\JetBrains\PyCharm 2018.2.4\helpers\pydev\pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Program Files\JetBrains\PyCharm 2018.2.4\helpers\pydev\pydevd.py", line 1068, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2018.2.4\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 11, in execfile
stream = tokenize.open(file) # @UndefinedVariable
File "C:\Program Files\Python36\lib\tokenize.py", line 454, in open
encoding, lines = detect_encoding(buffer.readline)
File "C:\Program Files\Python36\lib\tokenize.py", line 431, in detect_encoding
encoding = find_cookie(first)
File "C:\Program Files\Python36\lib\tokenize.py", line 395, in find_cookie
raise SyntaxError(msg)
SyntaxError: invalid or missing encoding declaration for 'C:/Program Files/Anaconda3/Scripts/scrapy.exe'
有人建议我在做什么错吗?
感谢您的答复!
答案 0 :(得分:0)