Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pip install *.whl on Windows (using a wildcard)

Tags:

python

pip

For some reason, I cannot pip install %CD%\*.whl as I will then get:

Requirement 'C:\\Users\fredrik\\Downloads\\*.whl' looks like a filename, but the file does not exist
`*.whl is not a valid wheel filename.

On macOS (and I believe on Linux), I can do this without issues:

pip install *.whl
Processing ./certifi-2017.11.5-py2.py3-none-any.whl
Processing ./chardet-3.0.4-py2.py3-none-any.whl
Processing ./idna-2.6-py2.py3-none-any.whl
Processing ./requests-2.18.4-py2.py3-none-any.whl
Processing ./urllib3-1.22-py2.py3-none-any.whl
...

  1. Why is there a difference in this behavior between the platforms?
  2. Is there a preferred way to make this (pip install *.whl) work on Windows?
like image 203
fredrik Avatar asked Jan 10 '18 08:01

fredrik


1 Answers

If you know the package name e.g. foo You can use this:

python -m pip install --find-links=C:\Users\fredrik\Downloads foo

this will find any foo package e.g. foo-X.Y.Z-cp37-cp37m-win_amd64.whl etc...

If you don't know the package name then you can try:

FOR %%i in (C:\Users\fredrik\Downloads\*.whl) DO python -m pip install %i
like image 79
Mizux Avatar answered Oct 12 '22 15:10

Mizux