python使用pip卸载和安装库「建议收藏」

python使用pip卸载和安装库「建议收藏」pip先来演示pip的错误打开方式:C:\Users\86188>pyPython3.8.2(tags/v3.8.2:7b3ab59,Feb252020,22:45:29)[MSCv.191632bit(Intel)]onwin32Type”help”,”copyright”,”credits”or”license”formoreinformation.>>>pipTraceback(mostrecentcalllast

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

pip

先来演示pip的错误打开方式:

C:\Users\86188>py
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> pip
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'pip' is not defined
>>>

问题出在哪呢?细心的同学会问了。其实呢,pip虽然是python的自带工具,而且安装了python之后会自动安装上pip,但pip工具并不能在python中打开哦!
下面我们演示如何在命令行中退出python,之后打开pip:

>>> exit()

C:\Users\86188>pip

Usage:
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  config                      Manage local and global configuration.
  search                      Search PyPI for packages.
  cache                       Inspect and manage pip's wheel cache.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  debug                       Show information useful for debugging.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be used up to 3 times (corresponding to
                              WARNING, ERROR, and CRITICAL logging levels).
  --log <path>                Path to a verbose appending log.
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --retries <retries>         Maximum number of retries each connection should attempt (default 5 times).
  --timeout <sec>             Set the socket timeout (default 6000.0 seconds).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup,
                              (a)bort.
  --trusted-host <hostname>   Mark this host or host:port pair as trusted, even though it does not have valid or any
                              HTTPS.
  --cert <path>               Path to alternate CA bundle.
  --client-cert <path>        Path to SSL client certificate, a single file containing the private key and the
                              certificate in PEM format.
  --cache-dir <dir>           Store the cache data in <dir>.
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine whether a new version of pip is available for
                              download. Implied with --no-index.
  --no-color                  Suppress colored output
  --no-python-version-warning
                              Silence deprecation warnings for upcoming unsupported Pythons.

C:\Users\86188>

先输入exit(),回车,我们就从python的界面退出了。
接着输入pip回车,就出现了长达一整页的提示,其中包括了install、uninstall等,都是可以使用pip完成的功能。
那么我们来用pip卸载一个库吧!首先,以绘图工具pandas为例来试一试:

C:\Users\86188>pip uninstall pandas
Found existing installation: pandas 1.0.5
Uninstalling pandas-1.0.5:
  Would remove:
    c:\users\86188\appdata\local\programs\python\python38-32\lib\site-packages\pandas-1.0.5.dist-info\*
    c:\users\86188\appdata\local\programs\python\python38-32\lib\site-packages\pandas\*
Proceed (y/n)? 

输入pip uninstall pandas,会看到命令行出现以上反应,并且会有一个”继续(是/否)的提示,此时如果我们输入y并按回车,卸载进程就会继续,如果我们输入n并按回车,卸载过程就会停止。
我输入了y和回车,结果如下:

 Proceed (y/n)? y
  Successfully uninstalled pandas-1.0.5

接下来我们再来安装,输入“pip install pandas”,可以看到如下界面:

C:\Users\86188>pip install pandas
Looking in indexes: http://pypi.douban.com/simple
Collecting pandas
  Downloading http://pypi.doubanio.com/packages/0d/3b/c306fc4c669f9208ba5a62d29a71fcb5df3be80a914da9e7b30ad682589f/pandas-1.0.5-cp38-cp38-win32.whl (7.6 MB)
     |████████████████████████████████| 7.6 MB 1.3 MB/s
Requirement already satisfied: numpy>=1.13.3 in c:\users\86188\appdata\local\programs\python\python38-32\lib\site-packages (from pandas) (1.19.0)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\86188\appdata\roaming\python\python38\site-packages (from pandas) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in c:\users\86188\appdata\local\programs\python\python38-32\lib\site-packages (from pandas) (2020.1)
Requirement already satisfied: six>=1.5 in c:\users\86188\appdata\roaming\python\python38\site-packages (from python-dateutil>=2.6.1->pandas) (1.14.0)
Installing collected packages: pandas
Successfully installed pandas-1.0.5

此时需要联网,进度条是下载的进度,Successfully installed pandas-1.0.5是”成功安装pandas-1.0.5版本“的意思。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/180218.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • getResourceAsStream和getClassLoader

    getResourceAsStream和getClassLoader1. Class.getResourceAsStream(Stringpath):path不以’/’开头时默认是从此类所在的包下取资源,以’/’开头则是从ClassPath根下获取。其只是通过path构造一个绝对路径,最终还是由ClassLoader获取资源。 2.Class.getClassLoader.getResourceAsStream(Stringpath):默认则

    2022年6月9日
    46
  • 带你了解软件系统架构的演变

    带你了解软件系统架构的演变一个成熟的系统,并不是一开始就做到方方面面都完美,也不会去考虑什么高并发,高可用问题,但随着时间的推移,现有架构的问题就会慢慢的显现。比如用户激增,访问量不断增大,在这过程中,会不断的出现新的问题,而为了解决这些问题,软件技术架构都会发生重大变化,而针对不同业务特征的系统会有各自的侧重点,像淘宝这类网站要解决的事海量商品搜索下单支付等问题。像腾讯要解决数亿级别用户的实施消息传输等。每种业务都有自己不同的系统架构。以JavaWeb为例搭建简单的电商系统这个电商系统有多个业务模块,假设现在有:.

    2022年6月17日
    25
  • 新手小白学JAVA 冒泡排序

    新手小白学JAVA 冒泡排序3冒泡排序bubble3.1概念冒泡排序(BubbleSort),是一种计算机科学领域的较简单的排序算法。它重复地走访过要排序的元素列,依次比较两个相邻的元素,如果他们的顺序(如从大到小、首字母从A到Z)错误就把他们交换过来。走访元素的工作是重复地进行直到没有相邻元素需要交换,也就是说该元素已经排序完成。这个算法的名字由来是因为越大的元素会经由交换慢慢“浮”到数列的顶端(升序或降序排列),就如同碳酸饮料中二氧化碳的气泡最终会上浮到顶端一样,故名“冒泡排序”。3.2形式相邻比较,从小到大

    2022年7月19日
    17
  • 提高网站页面加载速度的方法

    提高网站页面加载速度的方法

    2021年9月23日
    51
  • 你想要了解的黑客入门知识在这里

    你想要了解的黑客入门知识在这里开篇特此声明,萌新博主所写这篇文章的初衷并不是想让大家成为一名黑客,去做出一些违反国家法律规定的违规操作,只是单纯的想介绍一下成为黑客所要了解的知识以及一些必要的黑客术语,从读者的角度去满足一些计算机爱好者的好奇心。博主心底善良,为人正直,遵守国家法律规定。如有违反,望各位读者监督,另外图谋不轨者,严禁转载!!————————————————分割线———————————————————————…

    2022年5月5日
    35
  • php递归算法经典实例_递归算法的步骤

    php递归算法经典实例_递归算法的步骤递归算法对于任何一个编程人员来说,应该都不陌生。因为递归这个概念,无论是在PHP语言还是Java等其他编程语言中,都是大多数算法的灵魂。对于PHP新手来说,递归算法的实现原理可能不容易理解。但是只要你了解掌握了这个算法原理,就可以灵活运用递归算法实现编程中的多种功能比如实现无限分类等。递归也是入门者最需要掌握的一个基础算法技巧。下面郑州网站建设公司燚轩科技就通过具体代码示例为大家介绍PHP递归算法…

    2022年8月11日
    6

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号