Everything I read says that pip should have been installed with my download of PYTHON 3.10.2, yet my every attempt to use pip is rejected with some statement to the effect of
“‘pip’ is not recognized as an internal or external command, opereable program, or batch file.”
my command line looks like:
C:\Users\James Parks>pip install PyPDF2
My computer came with Windows 11 installed, but the Command Prompt screen says “Microsoft Windows [version 10.0.22000.493]”
By default, the “py.exe” launcher is installed, and the installer tries to ensure that it’s always available in PATH. You can run pip using the launcher via py -m pip. For example, use py -m pip install PyPDF2.
That said, unless you absolutely have to install packages to the system site packages, consider using a virtual environment instead. Create one via py -m venv "{venv_name}", where “{venv_name}” is the name of the directory in which to create the virtual environment. This can be relative to the current directory, such as py -m venv project_x, or a fully qualified path such as py -m venv "%USERPROFILE%\Documents\project_x".
Activate the virtual environment via "{venv_name}\Scripts\activate". After activating the environment, the python and pip commands work in the context of the activated environment, as does the system py command. When finished working in the environment, run deactivate. Activating an environment is for convenience, but you can also run qualified binaries and scripts from the environment without activating it, e.g. "{venv_name}\Scripts\python" or "{venv_name}\Scripts\pip".
If you switch to using a POSIX OS such as macOS or Linux, the scripts directory in a virtual environment is named “bin” instead of “Scripts”; paths in the shell use forward slashes instead of backslashes; and the activation script has to be sourced. For example, activate an environment in POSIX via source "{venv_name}/bin/activate".
Windows 11 is a product name, and as a product it’s significantly different from Windows 10 (e.g. significant changes in the user interface). The major.minor version number concerns API compatibility, though more recent builds may extend the API with new features and capabilities. The major.minor version number is 10.0 for both Windows 10 and 11. They can be distinguished by the build number. The latest build number for Windows 10 is 19044. Build numbers for Windows 11 are 22000 and above.
The attachment shows the result of my attempt to follow your suggestion. Sorry for my ignorance, but I’m just starting to learn Python. Can you tell me why it didn’t work? Thanks for the help.
Python 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
You’re trying to run the command in Python’s interactive shell, but it’s not Python code. “py.exe” is an executable file. Usually it should be run from the system shell, such as CMD (command prompt) or PowerShell.
If Python was installed for all users, you may need to run the shell with administrator (elevated) access in order for py -m pip install PyPDF2 to work. In that case, an alternative if you don’t want to install to the system site packages is to use py -m pip install --user PyPDF2 to install to the user site packages, or follow the previous instructions to create a virtual environment.