0

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!

BWN133
  • 23
  • 3

1 Answers1

1

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

Markus Rosjat
  • 146
  • 2
  • 8
  • I have an example for a syslink there ln is your friend – Markus Rosjat Jun 22 '21 at 12:16
  • Thanks for the help and indeed it shows the symlink. But it seems like when I input: python3-config --libs it still shows: -lpython3.5m -lpthread -ldl -lutil -lm – BWN133 Jun 22 '21 at 12:21
  • again you might need to delete the exisiting symlink first, to make a new one if python3-config points at python3.5-config it will look at the configdir for 3.5 – Markus Rosjat Jun 22 '21 at 12:27