Mailing List Archive

Python added to PATH, cannot be directly accessed, cannot install pip
Hello team at python.org,



I've asked this question on a forum and tried to figure it out myself, but
I'm at a dead end. I don't know if you guys answer questions like this but
I have no where else to turn to.



I am using a Lenovo Laptop using Windows. I'm trying to install
get-pip.py, and when I enter "python get-pip.py" into the Command Prompt,
it says "Python was not found; run without arguments to install from the
Microsoft Store, or disable this shortcut from Settings > Manage App
Execution Aliases."



So for a week, I've been trying to add Python to PATH, so I can install
get-pip.py to Python.



I've added the exact file location for Python to Path in both User
Variables and System Variables. I've executed Manage App Execution
Aliases, turned off both App Installer python.exe and App Installer
python3.exe. Still can't install pip, Python was still not found. I've
tried different keywords ("py get-pip.py", python3 get-pip.py", etc.).
Still doesn't work.



Python is added to PATH and I can still run Python scripts, but I can't
find Python directly through the Command Prompt, and I cannot install
get-pip.py to Python.



For reference, I have Python version 3.9.6 and I installed Python directly
from the site (I did not use Anaconda).



Can you guys help me with this? Or do I need to delete Python and
reinstall it?



Sincerely, Will






--
https://mail.python.org/mailman/listinfo/python-list
Re: Python added to PATH, cannot be directly accessed, cannot install pip [ In reply to ]
On 9/27/21, Will <willcyr852000@gmail.com> wrote:
>
> I am using a Lenovo Laptop using Windows. I'm trying to install
> get-pip.py

The installer includes pip by default and has an option to update PATH
for you, though the latter isn't enabled by default.

Latest 64-bit release:
https://www.python.org/ftp/python/3.9.7/python-3.9.7-amd64.exe
--
https://mail.python.org/mailman/listinfo/python-list
Re: Python added to PATH, cannot be directly accessed, cannot install pip [ In reply to ]
On 9/27/21 08:00, Will wrote:
> Hello team at python.org,
>
>
>
> I've asked this question on a forum and tried to figure it out myself, but
> I'm at a dead end. I don't know if you guys answer questions like this but
> I have no where else to turn to.
>
>
>
> I am using a Lenovo Laptop using Windows. I'm trying to install
> get-pip.py, and when I enter "python get-pip.py" into the Command Prompt,
> it says "Python was not found; run without arguments to install from the
> Microsoft Store, or disable this shortcut from Settings > Manage App
> Execution Aliases."
>
>
>
> So for a week, I've been trying to add Python to PATH, so I can install
> get-pip.py to Python.
>
>
>
> I've added the exact file location for Python to Path in both User
> Variables and System Variables. I've executed Manage App Execution
> Aliases, turned off both App Installer python.exe and App Installer
> python3.exe. Still can't install pip, Python was still not found. I've
> tried different keywords ("py get-pip.py", python3 get-pip.py", etc.).
> Still doesn't work.
>
>
>
> Python is added to PATH and I can still run Python scripts, but I can't
> find Python directly through the Command Prompt, and I cannot install
> get-pip.py to Python.
>
>
>
> For reference, I have Python version 3.9.6 and I installed Python directly
> from the site (I did not use Anaconda).
>
>
>
> Can you guys help me with this? Or do I need to delete Python and
> reinstall it?

In addition to Eryk's comments...

Try invoking Python from a command prompt by typing "py" (I think you
knew this). For a python.org installation, as long as you didn't
deselect the installation of the Python Launcher, that's the way to
launch it. Meanwhile, you can also install from the Microsoft Store -
and the message you're getting is from the little stub that tries to be
helpful about telling you this when you try as "python" - that's not
Python itself that's running, it's the Windows helper.

pip, meanwhile, is not in the same directory as the python executable,
so even "adding python to PATH" doesn't solve the problem of running
pip. Invoke it like this instead:

py -m pip install foo


you _can_ add the scripts subdirectory of the python install location to
PATH as well, but it's better to get in the habit of running pip as a
module, because it works way better once you have multiple pythons
installed (which happens a lot).

--
https://mail.python.org/mailman/listinfo/python-list
Re: Python added to PATH, cannot be directly accessed, cannot install pip [ In reply to ]
On 9/27/21, Mats Wichmann <mats@wichmann.us> wrote:
>
> pip, meanwhile, is not in the same directory as the python executable,
> so even "adding python to PATH" doesn't solve the problem of running
> pip. Invoke it like this instead:

The installer's option to add Python to PATH adds both the
installation directory and the scripts directory. The latter has
"pip.exe", assuming pip was installed.

> py -m pip install foo

If the `pip` command is on PATH, for an installation or active virtual
environment, it's usually fine to use it instead of `py -m pip` or
`python -m pip`. But there's one caveat. The `pip` command can't be
used to upgrade pip itself. For that you have to run the module via
`'py -m pip` or `python -m pip`.
--
https://mail.python.org/mailman/listinfo/python-list