快速解决:完全卸载Linux系统中的pip3操作步骤 (linux彻底卸载pip3)

在使用Linux系统中,安装和卸载软件往往通过命令行完成,pip3是Python语言中常用的安装包管理工具,但是有时候在使用过程中可能出现问题需要进行卸载操作。本文将详细介绍在Linux系统中如何快速解决完全卸载pip3的操作步骤。

1.检查pip3是否已经安装

在使用pip3之前,需要先确认该软件是否已经安装。在Linux系统中,可以通过以下命令来检查pip3是否安装:

sudo apt-get update

sudo apt-get install python3-pip

如果已经安装了pip3,系统会显示已经是最新版本,否则会安装pip3到系统中。在确认pip3已经安装后,才能进行下一步操作。

2.卸载pip3

在卸载pip3之前,需要先关闭当前终端窗口,然后打开一个新的终端窗口进行操作。在终端窗口中输入以下命令来卸载pip3:

sudo apt-get remove python3-pip

该命令将会卸载与pip3相关的所有文件,包括配置文件、依赖库以及安装目录中的文件。

3.删除pip3残余文件

虽然上一步已经卸载了pip3,但是系统还有一些残留文件需要手动删除。在终端窗口中输入以下命令来删除pip3残余文件:

sudo rm -rf /usr/bin/pip3

sudo rm -rf /usr/local/bin/pip3

sudo rm -rf /usr/share/man/man1/pip3.1*

sudo rm -rf /usr/share/doc/python3-pip

这些命令将会删除pip3的可执行文件、源码文件和帮助文档等相关文件。

4.清空pip3缓存

在Linux系统中,pip3还会有一些缓存文件,需要手动清空。在终端窗口中输入以下命令来清空pip3缓存:

rm -rf ~/.cache/pip3

该命令将会清空pip3缓存中的所有文件,包括下载的包、语言缓存等。

5.完成卸载

完成上述步骤后,pip3就已经完全卸载了。用户可以通过在终端窗口中输入pip3命令来确认pip3已经不可用。

在Linux系统中,卸载pip3需要进行多步操作,如果只使用sudo apt-get remove python3-pip命令,不彻底删除残留文件和清空缓存,可能会导致后续操作出现问题。因此,在卸载pip3之前,建议用户先备份系统文件并严格按照步骤操作。这样能够有效避免出现不必要的问题,让Linux系统保持稳定和高效运行。

相关问题拓展阅读:

如何这道tensorflow卸载成功 linux

安装tensorflow

pip install –upgrade

错误:oserror no such file or directory site-packages/setuptools-21.0.0-py2.7.egg

解决:pip install –upgrade

–ignore-installed

Python 2.7.3 (default, Apr, 11:18:30)

on linux2

Type “help”, “copyright”, “credits” or “license” for more information.

>>> import tensorflow as tf

Traceback (most recent call last):

File “”, line 1, in

File “/usr/local/python27/lib/python2.7/site-packages/tensorflow/__init__.py”, line 23, in

from tensorflow.python import *

File “/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/__init__.py”, line 45, in

from tensorflow.python import pywrap_tensorflow

File “做毁/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py”, line 28, in

_pywrap_tensorflow = swig_import_helper()

File “/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py”, line 24, in swig_import_helper

_mod = imp.load_module(‘_pywrap_tensorflow’, fp, pathname, description)

ImportError: /lib64/libc.so.6: version `GLIBC_2.15′ not found (required by /usr/local/python27/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so)

tensorflow0.80版本编译的时候使用GLIBC_2.15,系统自带的是GLIBC_2.12,所以报错了。

安灶枝装新版glibc

1.glibc下载

下载源代码。我下载的版本是2.20,链接地址是

2.安装

因为glibc库使用广泛,为了避免污染当前系统环境,更好自定义安装目录,使用时定义一下环境变量就行了。具体步骤如下:

我使用的法(直接升级glibc)隐胡敏:

wget

xz -d glibc-2.17.tar.xz

tar -xvf glibc-2.17.tar

cd glibc-2.17

mkdir build

cd build

../configure –prefix=/usr –disable-profile –enable-add-ons –with-headers=/usr/include –with-binutils=/usr/bin

make && make install

需要等大概10分钟。

输入strings /lib64/libc.so.6|grep GLIBC发现已经更新

Python 2.7.3 (default, Apr, 11:18:30)

on linux2

Type “help”, “copyright”, “credits” or “license” for more information.

>>> import tensorflow as tf

Traceback (most recent call last):

File “”, line 1, in

File “/usr/local/python27/lib/python2.7/site-packages/tensorflow/__init__.py”, line 23, in

from tensorflow.python import *

File “/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/__init__.py”, line 45, in

from tensorflow.python import pywrap_tensorflow

File “/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py”, line 28, in

_pywrap_tensorflow = swig_import_helper()

File “/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py”, line 24, in swig_import_helper

_mod = imp.load_module(‘_pywrap_tensorflow’, fp, pathname, description)

ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14′ not found (required by /usr/local/python27/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so)

没有GLIBCXX_3.4.14版本支持,继续安装(注意:libstdc++6_4.7.2-5_amd64.deb这是64位,libstdc++6_4.7.2-5_i386.deb这个是32位)

下载新版本,地址:

ar -x libstdc++6_4.7.2-5_amd64.deb&&tar xvf data.tar.gz

#cd /root/usr/lib/x86_64-linux-gnu

#ll

lrwxrwxrwx 1 root rootApr 26 15:21 libstdc++.so.6 -> libstdc++.so.6.0.17

-rw-r–r– 1 root rootJanlibstdc++.so.6.0.17

# find / -name libstdc++.so.6

/usr/lib64/libstdc++.so.6

/root/usr/lib/x86_64-linux-gnu/libstdc++.so.6

#mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.bak

#cp libstdc++.so.6.0.17 /usr/lib64/

#cd /usr/lib64/

#chmod +x libstdc++.so.6.0.17

#ll libstdc++.so.6.0.17

-rwxr-xr-x 1 root rootApr 26 15:30 libstdc++.so.6.0.17

#ln -s libstdc++.so.6.0.17 libstdc++.so.6

>>> import tensorflow as tf

Traceback (most recent call last):

File “”, line 1, in

File “/usr/local/python27/lib/python2.7/site-packages/tensorflow/__init__.py”, line 23, in

from tensorflow.python import *

File “/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/__init__.py”, line 45, in

from tensorflow.python import pywrap_tensorflow

File “/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py”, line 28, in

_pywrap_tensorflow = swig_import_helper()

File “/usr/local/python27/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py”, line 24, in swig_import_helper

_mod = imp.load_module(‘_pywrap_tensorflow’, fp, pathname, description)

ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.19′ not found (required by /usr/local/python27/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so)

从网上下载libstdc++.so.6.0.20

或者

放到/usr/lib64/下

#chmod +x libstdc++.so.6.0.20

#rm libstdc++.so.6

#ln -s libstdc++.so.6.0.20 libstdc++.so.6

#strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX

ImportError: cannot import name pywrap_tensorflow

edit: The real fix for me was to updated setuptools to the latest and it allowed me to upgrade mock and six to the latest. I was on setuptools 3.3. In my case I also had to remove said modules by hand because they were owned by OS in ‘/usr/local/lib/python2.7/dist-packages/’

check versions of everything

pip freeze | grep -e six -e mock

easy_install –version

Update everything

wget

-O – | sudo python

pip install mock –upgrade

pip install six –upgrade

终于成功了。

>>> import tensorflow as tf

>>> hello = tf.constant(‘Hello, TensorFlow!’)

>>> sess = tf.Session()

>>> sess.run(hello)

Hello, TensorFlow!

>>> a = tf.constant(10)

>>> b = tf.constant(32)

>>> sess.run(a+b)

>>>

>>> print product

Tensor(“MatMul:0”, shape=(1, 1), dtype=float32)

>>> sess = tf.Session()

>>> result = sess.run(product)

>>> print result

>

>>> sess.close()

关于linux彻底卸载pip3的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。


数据运维技术 » 快速解决:完全卸载Linux系统中的pip3操作步骤 (linux彻底卸载pip3)