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.
In your Python interpreter, type the following commands:
>>> import os, sys
>>> os.path.dirname(sys.executable)
'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python313'