首先在vscode里的扩展商店里搜索python,然后安装。 安装成功后,重启vscode。会提示你安装pylint,这是python的代码分析工具。 ------------------------------------------------ python版本为3.6.5 selenium版本为3.11.0 ------------------------------------------------ chrome版本76 chromedriver.exe版本为76 版本要对应才行 通过pip安装selenium pip install selenium==3.11 pythonpip都需要手工配置系统环境变量 python -m pip install --upgrade pip 即可更新到需要的pip版本 查看python是否安装成功,命令行里输入 python 查看pip是否安装成功,命令行里输入 pip -V 查看selenium是否安装成功,命令行里输入 pip show selenium ---------------------------------------------------------------------- 我们用vscode开发python时,常常会遇到找不到自定义模块的大坑,在vscode里点击运行,然后添加配置(工作区)即workspace.json,把文件打开,添加 "settings": { "python.pythonPath": "D:\python\python.exe", "python.linting.pylintArgs":[ "--disable=no-name-in-module","--disable=import-error", "--disable=unused-import","--disable=unused-argument","--disable=missing-docstring", "--disable=unused-variable","--disable=wrong-import-order","--disable=ungrouped-imports", "--load-plugins", ], }, "launch": { "version": "0.2.0", "configurations": [ { "name": "Python", "type": "python", "request": "launch", "stopOnEntry": false, "pythonPath": "${config:python.pythonPath}", "program": "${file}", "cwd": "${workspaceRoot}", "env": {"PYTHONPATH":"${workspaceRoot}"}, "envFile": "${workspaceRoot}/.env", } ] } ------------------------------------------------------------------------