pdb
pip in Windows
- 为了各版本兼容问题,python 在 Windows安装后,一般默认可用命令为 py,而非 python。
- pip默认随附安装,通过
py -m pip --version 查看是否安装。
Verification: You can check if pip is installed by running python -m pip --version or py -m pip --version in the command prompt.
If pip is not found, you will receive an error message.
pip 25.2 from C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip (python 3.13)
- pip 加入到 "环境变量" 中
Verification: You can check your PATH environment variables by searching for "Environment Variables" in the Windows search bar and then clicking on "Edit the system environment variables." In the System Properties window, click "Environment Variables," and then under "System variables," find the "Path" variable and click "Edit." Ensure the Scripts directory of your Python installation is listed.
- 如果不想把 pip 路径加到环境变量中,可以通过 py -m 直接显式调用 pip:
Use python -m pip: As a workaround, you can always execute pip by explicitly calling the Python interpreter, for example: python -m pip install <package_name>. This bypasses the need for pip to be directly in the PATH.
pip 安装 Selenium 库
- 打开命令行:以管理员身份运行 Windows PowerShell。(普通的cmd权限不够)
- 执行命令
pip install selenium 下载并安装Selenium 库。
- 安装 webdriver-manager:
pip install webdriver-manager
python version
In your Python interpreter, type the following commands:
>>> import os, sys
>>> os.path.dirname(sys.executable)
'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python313'
网友评论