python-config

How to change python-config version on ubuntu


I have installed python3.6 in my desktop which already had python3.5 and python2.7 inside. I change the default path for both python and python3 to python3.6 but it seems like python-config is still on python2.7 and python3-config is still on python3.5. How can I change the default python3-config or python-config to python3.6-config? Thanks for the help!


Solution

  • so to elaborate on my comment, python comes usually with a version attached like so

    ls -lisa /usr/local/bin/ | grep python
    34138948    16 -r-xr-xr-x    2 root  wheel      5248 15 Apr. 03:12 python3.7
    34138954     0 lrwxr-xr-x    1 root  wheel        17 15 Apr. 03:12 python3.7-config -> python3.7m-config
    34138948    16 -r-xr-xr-x    2 root  wheel      5248 15 Apr. 03:12 python3.7m
    34138949     8 -r-xr-xr-x    1 root  wheel      2936 15 Apr. 03:12 python3.7m-config
    34127071    16 -r-xr-xr-x    1 root  wheel      5216 15 Apr. 10:59 python3.9
    34127072     8 -r-xr-xr-x    1 root  wheel      3153 15 Apr. 10:59 python3.9-config
    

    as you can see some names are already symlinks (the once with the -> ) so if you wanna access python3.9-config as python3-config you need to make a symlink with the name python3-config that points to the binary python3.9-config.

    % sudo ln -s /usr/local/bin/python3.9-config /usr/local/bin/python3-config
    

    so which should now give you

    % which python3-config
    /usr/local/bin/python3-config
    

    looking at the directory again shows the symlink now

    % ls -lisa /usr/local/bin | grep python3
    34127092     0 lrwxr-xr-x    1 root  wheel        31 22 Juni 14:09 python3-config -> /usr/local/bin/python3.9-config
    34138948    16 -r-xr-xr-x    2 root  wheel      5248 15 Apr. 03:12 python3.7
    34138954     0 lrwxr-xr-x    1 root  wheel        17 15 Apr. 03:12 python3.7-config -> python3.7m-config
    34138948    16 -r-xr-xr-x    2 root  wheel      5248 15 Apr. 03:12 python3.7m
    34138949     8 -r-xr-xr-x    1 root  wheel      2936 15 Apr. 03:12 python3.7m-config
    34127071    16 -r-xr-xr-x    1 root  wheel      5216 15 Apr. 10:59 python3.9
    34127072     8 -r-xr-xr-x    1 root  wheel      3153 15 Apr. 10:59 python3.9-config
    

    cheers

    Markus