Linux удалить полностью python

How to Uninstall Python

We may want to remove Python in our Linux or Windows systems for different reasons – conflicting packages and the need for a given Python version are some top reasons. Unlike in Windows, Python is a core program in most Linux distributions. In this case, uninstalling Python without utmost care may cause your Linux system to break. This article focuses on how we can safely remove Python from Windows and Linux systems.

How to Uninstall Python in Linux

Most Linux distros come with Python installed. In fact, in most cases, the default Python coming with the operating system is a core package for the system such that if it is removed, the graphical display manager breaks down, among other awful things. Other Python version(s) can also be installed alongside Linux-inbuilt Python (we will discuss how to do this later). We can safely remove the Python built from the source, but removing the Python that came with the distribution is not recommended.

To uninstall Python installed from the source, follow these steps:

Step A. First of all, check all the Python versions installed using the whereis command in Linux

From Figure 1, what we are after are the binaries. They are located at bin/or local/bin. The inbuilt Python is in bin/, whereas the Python built from the source is mainly installed at the local/bin. In our case, we have Python3.9 (inbuilt – we don’t want to uninstall this) and Python3.6 located in local/bin directory, and we can safely remove it.

The following list can fully explain the Linux directories we are interested in:

  • /bin – binary or executable programs.
  • /lib – it contains kernel modules and a shared library.
  • /usr – user-related programs.
  • The /usr/local directory is where locally compiled applications are installed by default, preventing them from mucking up the rest of the system.
  • /etc – system configuration files.
Читайте также:  Командная строка кали линукс команды

Many programs in most Linux distributions depend on pre-installed Python. You can identify the default Python by running python on the terminal. You can also find it by using which command.

If we take a closer look at the long listing of /usr/bin you will realize that Python and its dependencies are linked to other programs.

Источник

How to Uninstall Python in Ubuntu 22.04

Python is mainly used for software development, automation, and data science. Since Python is one of the easiest programming languages to learn, it is always advised to go with Python as the first programming language.

From the launch of Ubuntu 22.04, you will only get Python 3.8 installed, and they are no longer shipping with Python2 because it was launched in 2000. If you want to uninstall Python from Ubuntu be it Python 3 or Python2 you can follow this tutorial

But before that, let’s have a look at what Python has to offer

What is Python? What makes it so special?

Python is an object-oriented high-level programming language. It is a dynamic and interpreted programming language that also supports procedural-oriented programming.

Being a dynamic programming language, you don’t have to declare the type of variable such as

now, A can be used as String, Integer, and other applicable types

if you want an answer to what makes Python special, you have to go through its key features given below:

Ease of use: it is often recommended to beginners due to its lesser complex structure. Anyone determined to learn it can get a basic grasp in some days.

High-Level programming language: Being a high-level programming language, you don’t have to remember the system architecture or memory allocation during programming

Portable language: Python is a portable language means if you have written your code on a Windows machine, it can be run on any platform, such as Linux, without any changes.

Integrated language: Python is an integrated language because we can easily integrate Python with other programming languages such as C and C++.

Note: Removing Python from Ubuntu 20.04 can cause malfunctioning because many packages and tools heavily rely on Python. Have a complete backup of your system before precoding further.

Читайте также:  Чтение из консоли linux

Uninstalling Python from Ubuntu 20.04

We will show you how you can remove Python 2, Python 3, and Pip packages. So let’s start with removing Pip from our system.

Removing Pip from Ubuntu 20.04

Pip is a package manager for Python, which is similar to apt used on a daily basis to download and remove packages from Ubuntu. Using Pip, you can install required packages and Libraries. Open your Terminal and use the following command to remove Pip:

sudo apt-get remove python3-pip

uninstall python in ubuntu

If you want to remove Pip with all its dependencies, use the following command:

sudo apt-get remove --auto-remove python3-pip

2. sudo apt-get remove --auto-remove python3-pip

Now, if you want to remove Pip with its configuration and data, use the following command:

sudo apt-get purge python3-pip

3. sudo apt-get purge python3-pip

To remove configuration files, data, and dependencies completely, use the following command:

sudo apt-get purge --auto-remove python3-pip

4. sudo apt-get purge --auto-remove python3-pip

Removing Python 2 from Ubuntu 20.04

If you don’t need Python 2 installed on your system anymore, you can easily remove it by following commands:

1. sudo apt remove python2

If you want to remove dependencies of Python 2, use the following command:

sudo apt remove --auto-remove python2

2. sudo apt remove --auto-remove python2

If you want to remove Python 2 with all the configurations you have made, use the following command:

3. sudo apt purge python2

If you want to remove configuration files, data and dependencies included use the following command:

sudo apt purge --auto-remove python2

4. sudo apt purge --auto-remove python2

Removing Python 3 from Ubuntu 20.04

If you want to remove Python 3 due to some malfunctioning, you can follow the given commands:

1. sudo apt remove python3

If you are willing to remove Python 3 with all its dependencies included, use the given commands:

sudo apt remove --auto-remove python3

2. sudo apt remove --auto-remove python3

If you want to remove Python 3 with configurations you have made, use the following commands:

3. sudo apt purge python3

If you want to remove Python 3, including its dependencies, configuration, and data, use the following command:

sudo apt purge --auto-remove python3

4. sudo apt purge --auto-remove python3

Related Posts:

Wrapping up

This was our take on how to uninstall Python from Ubuntu. We have included everything from uninstalling Pip to both versions of Python. Remember to take backup while removing Python because there are major chances of malfunctioning.

Sagar Sharma

Sagar always uses Linux to its core and loves to write the technical side of system administration! While he’s not writing for GeniusGeeks, you can find him writing for core linux blogs like IT’SFOSS.com and LinuxHandBook.com

Читайте также:  Linux list all users logged in

Источник

How to make a complete removal of Python 3.9 in Ubuntu 16.04?

I installed Python 3.9 on my Ubuntu 16.04 LTS system, in addition to the default 2.7 and 3.5 that come with the system. I can call it perfectly by typing python3.9, and also use pip3.9 commands. I want to remove it form the system, for reinstalling it, or even and earlier version of python instead. I tried already sudo apt-get remove python3.9 , sudo apt-get autoremove python3.9 , sudo apt-get purge python3.9 , sudo apt-get remove —purge python3.9 and sudo apt-get autoremove —purge python3.9 . None seems to make effect. When I call python3.9 it comes:

Python 3.9.0 (default, Nov 14 2020, 00:35:31) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> 

3 Answers 3

in case you still need it.

first of all, it’s never advisable to uninstall python. check for instance this link.
having said this, Ubuntu 16.04 does not depend (wasn’t build) on Python 3.9 (check this out, for instance). thus, and in principle you shouldn’t be having problems fully uninstalling it. as it was my case.

i had no troubles following these steps; which for you/me would be something like:

sudo apt-get clean sudo apt-get autoremove --purge sudo apt-get remove python3.9 sudo apt-get autoremove 

Need more than «not working» to help you. Error messages, things you expect that aren’t happening, or vice versa, etc.

Hey your answer has helped me as well. but do you think its advisable to maybe consider upgrading my ubuntu 16 to say ubuntu 20? I have been using ubuntu 16 from around 2017 and after trying other versions like 17 and 18, i just decided to resort to my 16 because it was just stabler for me. but these days i get a lot of version conflicts with a lot of the software i always want to install. some advice.

hi @N.M.Jedidiah. this is more of a cautionary tale. rule #1: IF IT AIN’T BROKEN, DON’T TRY FIX IT :D. I upgraded to Ubuntu 20LTS, and it’s awesome. i was on Ubuntu 18. long story short: i ended up installing U20 from scratch cause my machine broke during the upgrading. So, 1st of all back up your files. then, do something like this. If you ended up having this issue you’ll be as miserable as i was; but if you never try.

Источник

Оцените статью
Adblock
detector