Search code examples
pythonlinuxpippipe

Pip install argument from unix pipe


I intend to create a script able to install one single wheel file (.whl) at my enviroment using pip, but the file wheel file change the version very frequent. Ex: For now the file name is Simulador-0.3.2.post0.dev2+g862e34a.dirty-py2.py3-none-any.whl but soon will be ..-0.3.3- ....

For install this version I can try to do this pip install Simulador-0.3.2.post0.dev2+g862e34a.dirty-py2.py3-none-any.whl

but this solution will stop to work as soon my version change, so I tried to create a ubuntu pipe

ls *.whl | pip install

But didn't work, show this message "ERROR: You must give at least one requirement to install (see "pip help install")" But don`t make sense, because the ls *.whl is sending a argument.

Any suggestion to fix the pipe?


Solution

  • Do it like

    pip install `ls *.whl`
    

    Where subcommand

    `ls *.whl`
    

    generates files list and echoes it as strings which is used by pip for install

    Or without passing any arguments from other command result like discussed

    pip install *.whl