I have a folder that will have a file name based on the python version being used.
PyICU-1.9.5-cp27-cp27m-macosx_10_6_x86_64.whl
PyICU-1.9.5-cp35-cp35m-macosx_10_6_x86_64.whl
I want to use bash to detect the 35
or 27
, and then execute a pip install <filename>
. I have GitHub Gist that has this hard coded, but instead of Hard coding the filename, I would like to detect the version, pick the filename with that version, and use it in a new command.
I would like to change the pip install
command based on the file name. I found some code to detect the python version; what's the next piece?
#from http://stackoverflow.com/questions/6141581/detect-python-version-in-shell-script
python -c 'import sys; print(sys.version_info[:])'
How do I detect the numbers after cp, so that I can construct this:
detected 34
, so:
pip installPyICU-1.9.5-cp34-cp34-macosx_10_6_x86_64.whl