[Tutor] (no subject)

Mats Wichmann mats at wichmann.us
Wed Mar 28 13:33:19 EDT 2018


On 03/28/2018 04:32 AM, Steven D'Aprano wrote:
> On Wed, Mar 28, 2018 at 03:08:00PM +0900, naoki_morihira at softbank.ne.jp wrote:
>> I want to install 3rd party module, ex openpyxl.
>> And I executed the following command in windows command prompt as follows:
>> pip install openpyxl
>> But pip is not recognized as executable command at windows.
> 
> What version of Python are you using?
> 
> If you have Python 3.4 or better, or Python 2.7.9, you can say:
> 
>   python -m ensurepip
> 
> at the Windows command prompt to install pip. If there are no 
> installation errors, then you can run 
> 
>   pip install openpyxl
> 
> at the Windows command prompt. No internet is needed for the first 
> command, but for the second you will need internet access.
> 
> https://docs.python.org/3/library/ensurepip.html
> 
> On Windows, if you have trouble running the "python" command, it might 
> be easier to use "py" instead:
> 
> https://docs.python.org/3/using/windows.html#from-the-command-line
> 
> 

I would add... modern Python on Windows includes pip, but pip is not in
the same directory as Python. So if you told the installer to add Python
to the path you could have something like (this is an example):

C:\Users\Foo\AppData\Local\Programs\Python\Python36-32

in your PATH, but pip is in the path

C:\Users\Foo\AppData\Local\Programs\Python\Python36-32\Tools

you can add the latter to your PATH as well; or, use

  python -m pip dosomething

in place of

  pip dosomething

That is, even if Windows doesn't have pip in its path, Python shguld
know how to find it as a module.





More information about the Tutor mailing list