Is it safe to replace the default Python interpreter MacOS X?

I have Python 2.6.1 installed by default, just like /usr/bin/pythonPython 3.1.2 installed in /usr/local/bin/python3.1. Given that I only use 3.x syntax, is it safe to replace the default interpreter (2.6) with 3.1 (with python-config enabled) using symbolic links (and deleting the old Python binary)? Or a system that relies on version 2.x for some purpose, I don’t know?

+3
source share
3 answers

If you are using only Python 3, run your scripts with

#! /usr/bin/env python3.1

And you will use the correct version without thinking about the system.

edit: , Python. script Python, . Python 3 , Python , , .

+8

python. Mac ... Python ... , Python, python. OS X Python, .

VirtualEnv.

: python-select macports, .

+2

Do not replace or delete any binary files if you do not need storage. In this case, there is too little mileage in their removal.

You can simply do 3.1 by default:

defaults write com.apple.versioner.python Version 3.1

There are other ways to ensure that you are using 3.1 by default, I have not used them.

export VERSIONER_PYTHON_VERSION=3.1
+1
source

Source: https://habr.com/ru/post/1765008/


All Articles