Пакет python is python3

Пакет: python-is-python3 (3.11.4-1)

Starting with the Debian 11 (bullseye) and Ubuntu 20.04 LTS (focal) releases, all python packages use explicit python3 or python2 interpreter and do not use unversioned /usr/bin/python at all. Some third-party code is now predominantly python3 based, yet may use /usr/bin/python.

This is a convenience package which ships a symlink to point the /usr/bin/python interpreter at the current default python3. It may improve compatibility with other modern systems, whilst breaking some obsolete or 3rd-party software.

No packages may declare dependencies on this package.

Другие пакеты, относящиеся к python-is-python3

  • зависимости
  • рекомендации
  • предложения
  • enhances
  • dep: python3 интерактивный высокоуровневый объектно-ориентированный язык (версия python3 по умолчанию)

Загрузка python-is-python3

Загрузить для всех доступных архитектур
Архитектура Размер пакета В установленном виде Файлы
all 3,0 Кб 15,0 Кб [список файлов]

Эта страница также доступна на следующих языках (Как установить язык по умолчанию):

Чтобы сообщить о проблеме, связанной с веб-сайтом, отправьте сообщение (на английском) в список рассылки debian-www@lists.debian.org. Прочую контактную информацию см. на странице Debian Как с нами связаться.

Авторские права © 1997 — 2023 SPI Inc.; См. условия лицензии. Debian это торговый знак компании SPI Inc. Об этом сайте.

Источник

The python-is-python3 package

Python is a popular high-level programming language. It’s now being used to build a large part of the internet, randing from large-scale web applications to major part of various operating system. Ubuntu/Debian includes Python as part of their standard packages.

But the languages has evolved, Python 3 does not backward compatible with its Python 2.x sibling, which leads to confusion among Linux beginners.

python-is-python3 is a package which makes Python 3 become the default version in Ubuntu/Debian instead of Python 2.

In other words, the package simply points python command (and binary path) to Python 3 system-wide.

In this article, we will try to explain the state of Python in Ubuntu and how python-is-python3 packages plays a significant role in that situation.

python-is-python3 on Ubuntu

On Ubuntu version 18.10 and older, both Python 2 and Python 3 was shipped with the OS. Python 2 can be called by running python in a terminal, while python3 is the alias for Python 3.

On Ubuntu 20.04 onwards, the developers removed and modified the legacy source code so that Python 2 can be removed. Only Python 3 is shipped with the OS out of the box. Because of that, python command now points to Python 3.

Newer versions of popular software acknowledge this change and update their code accordingly, so that the programs does not accidentally run Python 3 code in Python 2.x, which leads to errors. But a lot of them still expect python to be Python 2.x, renders the program unusable on Ubuntu 20.04 and later.

That’s where python-is-python3 package comes into play. The python-is-python3 package simply points python command (and binary path) to Python 3. In other words, python-is-python3 makes Python 3 the default version in Ubuntu instead of Python 2.

Does python-is-python3 really just create a single symlink? You may wonder why introducing a separate package for such a bare bone purpose.

The answer is simplicity. Linux distributions are extremely complex systems consist of many simple components that does their own things. The power of package managers comes in their flexibility to do simple things like this in a unified way.

For example, a server setup script might have a long list of apt packages that an application needs to be installed, and can simply include python-is-python3 in that list.

Having a dedicated package to make a symlink or a set of symlinks is considerably simpler than having a guide explaining how to create and manage the symlink manually.

And if you like the idea of having a dedicated package for making symlinks, there is a package similar to python-is-python3 for Python 2, which is python-is-python2. Also, there’s a python-is-python3 package available for Debian as well.

How to use python-is-python3

python-is-python3 provides neither a command-line interface nor GUI, all you need to do is install it onto your system by running the following command:

sudo apt- Once the installation is done, python command will use Python 3.x binary.

python-is-python3 on macOS

First and foremost, python-is-python3 is an Ubuntu-only package, which means there is no python-is-python3 for macOS.

But if you’re looking for the proper way to install or set Python 3 as default on Mac, we’ve got a few solutions.

Install Python 3 from installer

There’s a Python 3 installer for macOS that can be downloaded from Python official website. This installer places a new binary named python3 in /usr/local/bin/. If we want python command to call Python 3 instead of Python 2 on macOS, alias the command to the proper binary by running the following command.

 >> ~/.zshrc If you are using the default Bash shell, you can append this same line to your .bashrc:
 >> ~/.bashrc Please note that you won’t be able to automatically update Python if you’re doing things this way.

Install Python 3 with Homebrew

Homebrew is the macOS alternative for apt-get or yum package manager. We’re going to use pyenv – a separate package used to manage multiple Python versions on the same machine. If you’ve got Homebrew installed on your system, run the following command to install pyenv.

Then, install Python 3.8.6 by running:

  You can replace 3.8.6 with whatever version you want to install.

Alternatively, you can directly install Python with brew by running brew install python , but it’s not recommended since there are significant API changes in different Python 3.x releases, which may lead to error messages in your programs.

Once we’ve got Python3 installed, repeat the configuration steps above with ~/.zshrc and ~/.bashrc .

Fix python-is-python3 command not found

As I mentioned earlier, python-is-python3 provides neither a command-line interface nor a graphical user interface.

If you’re trying to call it by running python-is-python3 in a terminal, you’d be greeted with the python-is-python3 command not found error. There’s simply nothing you can do about that. Its only purpose is to create a symlink so that python command points to Python 3.x version.

We hope that the information above is useful to you. You may be interested in our guide on fixing “pip: command not found” error, “[Errno 32] Broken pipe” in Python and fix “Shadows name from outer scope” in PyCharm.

If you have any suggestions, feel free to comment below and we will add them to the article.

Источник

python-is-python3 package in Ubuntu 20.04 - what is it and what does it actually do?

Having used Ubuntu 18.04 for a handful of years now, and reading that Python 2 has been removed from Ubuntu 20.04, I was looking forward to using the commands python or pip rather than python3 or pip3 . So today I tried Ubuntu 20.04 for the first time, and found:

$ python --version Command 'python' not found $ python3 --version Python 3.8.5 
  1. Is python-is-python3 proprietary to Ubuntu/Canonical? If so, do other Linux distributions use python-is-python3 also or do some other distributions have a similar equivalent?
  2. I gather if I was to run python-is-python3 from the command prompt then I could use the command python instead of python3 . First can somebody confirm this, and second, does the same go for pip , i.e. pip instead of pip3 ?
  3. The launchpad.net link above mentions creation of a symlink. Does python-is-python3 really just create a single symlink? It seems odd to introduce a package for such a bare bones purpose. Also, if this package is subsequently uninstalled ( i.e. sudo apt --purge remove python-is-python3 ) does this remove the symlink?
  4. Are there any commonly used Python 2 packages out there anymore? I can't think of any offhand.
  5. Has anybody ran python-is-python3 and then later regretted doing so due to a reason that was not realized ahead of time?
  6. It seems the benefit of running python-is-python3 would be not having to add the 3 at the end of Python commands, but the disadvantage is that you would then have a non-standard Ubuntu setup, is this a fair summary of the python-is-python3 benefit/drawback?

1) No. 2) Yes. No. 3) Yes. Yes. 4) No. 5) Impossible to know with certainty, since we don't allow rants or reviews here. 6) Yes.

"do some other distributions have a similar equivalent?" - RHEL8 did something similar, and broke everything that had a shebang of #!/usr/bin/env python . Manjaro, which I use these days, seemed to handle the switch from Python 2 to 3 more smoothly.

2 Answers 2

In Ubuntu, all python packages use explicit python3 or python2 interpreter and do not use unversioned /usr/bin/python at all . No packages may declare dependencies on this package.

So, all official Ubuntu packages will depend explicitly on "python2" or "python3", and invoke the appropriate command. The default "python" command is deliberately undefined so that any scripts referencing it have to be updated to unambiguously depend on one version or the other.

However, users may have code that relies on the "python" command being available, and know that they can safely point it across their whole system to one version or the other. The python-is-python3 package (and its counterpart, python-is-python2 ) are a convenient way to set up a symlink for this purpose.

Does python-is-python3 really just create a single symlink? It seems odd to introduce a package for such a bare bones purpose.

Linux distributions are extremely complex systems made up of a large number of simple components. The power of package managers comes in their flexibility to do simple things like this in a unified way. For instance, a server setup script might have a long list of apt packages that an application needs to be installed, and can simply include python-is-python3 in that list. Shipping a package for this purpose is considerably simpler than having a user guide explaining how to manage the symlink manually.

Does the same go for pip , i.e. pip instead of pip3 ?

Apparently not - according to this LaunchPad bug, the python3 package automatically points pip at pip3 anyway.

If you open up the .deb file for the package (I used 7-Zip), you can see that apart from some documentation, it really does just contain one symlink, to be installed at /usr/bin/python , pointing to /usr/bin/python3 .

Источник

Пакет: python-is-python3 (3.9.2-1)

Starting with the Debian 11 (bullseye) and Ubuntu 20.04 LTS (focal) releases, all python packages use explicit python3 or python2 interpreter and do not use unversioned /usr/bin/python at all. Some third-party code is now predominantly python3 based, yet may use /usr/bin/python.

This is a convenience package which ships a symlink to point the /usr/bin/python interpreter at the current default python3. It may improve compatibility with other modern systems, whilst breaking some obsolete or 3rd-party software.

No packages may declare dependencies on this package.

Другие пакеты, относящиеся к python-is-python3

  • зависимости
  • рекомендации
  • предложения
  • enhances
  • dep: python3 интерактивный высокоуровневый объектно-ориентированный язык (версия python3 по умолчанию)

Загрузка python-is-python3

Загрузить для всех доступных архитектур
Архитектура Размер пакета В установленном виде Файлы
all 2,7 Кб 13,0 Кб [список файлов]

Эта страница также доступна на следующих языках (Как установить язык по умолчанию):

Чтобы сообщить о проблеме, связанной с веб-сайтом, отправьте сообщение (на английском) в список рассылки debian-www@lists.debian.org. Прочую контактную информацию см. на странице Debian Как с нами связаться.

Авторские права © 1997 - 2023 SPI Inc.; См. условия лицензии. Debian это торговый знак компании SPI Inc. Об этом сайте.

Источник

Читайте также:  Polymorphism in python classes
Оцените статью