How do I update a Python package?

后端 未结 12 2190
半阙折子戏
半阙折子戏 2020-11-29 15:47

I\'m running Ubuntu 9:10 and a package called M2Crypto is installed (version is 0.19.1). I need to download, build and install the latest version of the M2Crypto package (0.

相关标签:
12条回答
  • 2020-11-29 16:03

    Open Command prompt or terminal and use below syntax

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

    For Example

    pip install --upgrade numpy==1.19.1
    
    0 讨论(0)
  • 2020-11-29 16:06

    Get all the outdated packages and create a batch file with the following commands pip install xxx --upgrade for each outdated packages

    0 讨论(0)
  • 2020-11-29 16:08
    1. Via windows command prompt, run: pip list --outdated You will get the list of outdated packages.
    2. Run: pip install [package] --upgrade It will upgrade the [package] and uninstall the previous version.

    To update pip:

    py -m pip install --upgrade pip
    

    Again, this will uninstall the previous version of pip and will install the latest version of pip.

    0 讨论(0)
  • 2020-11-29 16:08

    How was the package originally installed? If it was via apt, you could just be able to do apt-get remove python-m2crypto

    If you installed it via easy_install, I'm pretty sure the only way is to just trash the files under lib, shared, etc..

    My recommendation in the future? Use something like pip to install your packages. Furthermore, you could look up into something called virtualenv so your packages are stored on a per-environment basis, rather than solely on root.

    With pip, it's pretty easy:

    pip install m2crypto
    

    But you can also install from git, svn, etc repos with the right address. This is all explained in the pip documentation

    0 讨论(0)
  • 2020-11-29 16:14

    I think the best one-liner is:

    pip install --upgrade <package>==<version>
    
    0 讨论(0)
  • 2020-11-29 16:16

    You might want to look into a Python package manager like pip. If you don't want to use a Python package manager, you should be able to download M2Crypto and build/compile/install over the old installation.

    0 讨论(0)
提交回复
热议问题