如何在 ubuntu 上更改 python-config 版本
How to change python-config version on ubuntu
我已经在我的桌面上安装了 python3.6,其中已经有 python3.5 和 python2.7。我将 python 和 python3 的默认路径更改为 python3.6 但似乎 python-config 仍在 python2.7 和 python3-config 仍在 python3.5。如何将默认的 python3-config 或 python-config 更改为 python3.6-config?
感谢您的帮助!
为了详细说明我的评论,python 通常会附带一个像这样的版本
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
如您所见,一些名称已经是符号链接(一次带有 -> )所以如果您想访问 python3.9-config 作为 python3-config 您需要创建一个符号链接名称 python3-config 指向二进制 python3.9-config.
% sudo ln -s /usr/local/bin/python3.9-config /usr/local/bin/python3-config
所以现在应该给你
% which python3-config
/usr/local/bin/python3-config
再次查看目录现在显示符号链接
% 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
干杯
马库斯
我已经在我的桌面上安装了 python3.6,其中已经有 python3.5 和 python2.7。我将 python 和 python3 的默认路径更改为 python3.6 但似乎 python-config 仍在 python2.7 和 python3-config 仍在 python3.5。如何将默认的 python3-config 或 python-config 更改为 python3.6-config? 感谢您的帮助!
为了详细说明我的评论,python 通常会附带一个像这样的版本
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
如您所见,一些名称已经是符号链接(一次带有 -> )所以如果您想访问 python3.9-config 作为 python3-config 您需要创建一个符号链接名称 python3-config 指向二进制 python3.9-config.
% sudo ln -s /usr/local/bin/python3.9-config /usr/local/bin/python3-config
所以现在应该给你
% which python3-config
/usr/local/bin/python3-config
再次查看目录现在显示符号链接
% 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
干杯
马库斯