我运行Ubuntu 9:10,安装了一个名为M2Crypto的包(版本为0.19.1)。我需要下载、构建和安装最新版本的M2Crypto包(0.20.2)。

0.19.1包的文件位于多个位置,包括(/usr/share/ pshared和/usr/lib/pymodules.python2.6)。

在安装0.20.2之前,如何从系统中完全卸载0.19.1版本?


当前回答

打开命令提示符或终端,并使用下面的语法

pip install --upgrade [package]==[specific version or latest version]

例如

pip install --upgrade numpy==1.19.1

其他回答

我发现最好的方法是从终端运行这个命令

sudo pip install [package_name] --upgrade

Sudo将要求输入root密码来确认操作。


注意:有些用户可能会安装pip3。在这种情况下,使用

sudo pip3 install [package_name] --upgrade
pip install -U $(pip list --outdated | awk 'NR>2 {print $1}')

我如何从我的系统完全卸载版本0.19.1之前 安装0.20.2吗?

以卸载M2Crypto使用

pip uninstall M2Crypto

我需要下载,建立和安装最新版本的 M2Crypto包(0.20.2)。

为了安装最新版本,可以使用PyPi

pip install M2Crypto 

要安装版本20.2(过时的版本),请运行

pip install M2Crypto==0.20.2

假设一个人只是想升级

pip install M2Crypto --upgrade # Or pip install M2Crypto -U

注:

Depending on one's Python version (here's how to find the version) one may use a different pip command. Let's say one is working with Python 3.7, instead of just using pip, one might use pip3.7. Using sudo is considered unsafe. Nowadays there are better practices to manage the development system, such as: virtual environments or development containers. The development containers allow one to put the entire development environment (be it modules, VS Code extensions, npm libraries,...) inside a Docker container. When the project comes to an end, one closes the container. There's no need to keep all of those requirements around in the computer for no reason. If you feel like reading more about it: Visual Studio Docs, Github.

打开命令提示符或终端,并使用下面的语法

pip install --upgrade [package]==[specific version or latest version]

例如

pip install --upgrade numpy==1.19.1

我认为最好的一句话是:

pip install --upgrade <package>==<version>