![]() ![]() At the top of the page, the command to install an older version of a package is shown, for example: pip install numpy=1.16.6. Note: often, support for older versions is dropped in larger updates (so when either the first or second version number is updated), so you can skip small updates to speed up your search process.įor example, using this process, you can deduce that numpy 1.19.5 is the latest version to support Python 3.6, and numpy 1.16.6 is the latest version to support Python 2.7. This is still a manual process, but less work than trying to install every single version. If you are using an older version of Python and need the most recent version of the package that is compatible with that version, you can go to the release history (the second link at the top of the sidebar) and try different versions, scrolling down to the "Meta" section for every version. Therefore, you need Python 3.7 or higher to install this version of numpy. For the current version of numpy, the following information is listed: As you do not specify the package you are looking for, I will use numpy as an example. This shows the Python version required by the package. I'm filtering out the python*-config programs with grep -v since they don't support the -version flag.You can look up the package on the Python Package Index and scroll down to the "Meta" section in the left sidebar. To include aliases, you could use eval (though this might be unsafe): eval "$p -version" For example if I had alias python=python3, the above would still show 2.7 for python. If you want to get the version of each of the above: compgen -c python | sort -u | grep -v - '-config$' | while read -r p do If you want to see all versions of Python available as commands in Bash, run compgen -c python. It's obviously a pretty hideous command but this is again real output and it seems to have done a fairly thorough job. media/ned/websites/venvold/bin/python: Python 2.7.4 ![]() If we assume that a Python binary is always going to be called python and be a binary file, we can just search the entire system for files that match those criteria: $ sudo find / -type f -executable -iname 'python*' -exec file -i '' | xargs readlink -f | sort -u | xargs -I % sh -c 'echo -n "%: " % -V' The fact is there could be hundreds of different versions of Python secreted around your system, either on paths that are contextually added, or living under different binary names (like python3). If we were in a Virtualenv (a common Python stack management system) python might resolve to a different version: $ readlink -f $(which python) | xargs -I % sh -c 'echo -n "%: " % -V' We can chain this in to show the version of that version of Python: $ readlink -f $(which python) | xargs -I % sh -c 'echo -n "%: " % -V'īut this is still only telling us what our current python resolution is. In default cases in 14.04 this will simply point to /usr/bin/python2.7. In Ubuntu we can check the resolution with readlink -f $(which python). But to see every version of python in your system takes a bit more. ![]() You can use python -V (et al.) to show you the version of Python that the python command resolves to. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |