如何使用 pip 更新/升级包? [英] How to update/upgrade a package using pip?

查看:26
本文介绍了如何使用 pip 更新/升级包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用pip更新包的方法是什么?那些不起作用:

What is the way to update a package using pip? those do not work:

pip update
pip upgrade

我知道这是一个简单的问题但它是必需的,因为它不是那么容易找到(pip 文档 不会弹出,堆栈溢出的其他问题也有相关性,但不完全是这样)

I know this is a simple question but it is needed as it is not so easy to find (pip documentation doesn't pop up and other questions from stack overflow are relevant but are not exactly about that)

推荐答案

方法是

pip install <package_name> --upgrade

或者简而言之

pip install <package_name> -U

使用 sudo 会要求输入您的 root 密码以确认操作,但虽然很常见,但被认为是 不安全.

Using sudo will ask to enter your root password to confirm the action, but although common, is considered unsafe.

如果您没有 root 密码(如果您不是管理员),您可能应该使用 虚拟环境.

If you do not have a root password (if you are not the admin) you should probably work with virtualenv.

您也可以使用用户标志仅在此用户上安装它.

You can also use the user flag to install it on this user only.

pip install <package_name> --upgrade --user

这篇关于如何使用 pip 更新/升级包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆