【问题标题】:How to restore previous package version in pip?如何在 pip 中恢复以前的包版本?
【发布时间】:2021-05-25 13:03:13
【问题描述】:

我在两台机器上分别使用两个 pandas 版本(是的,我知道这并不理想),我最近尝试在我的一台机器上升级我的 pandas 包,但现在我遇到了大量的错误。问题是,我的 requirements.txt 只注册了我另一台机器的熊猫版本(我没有升级的那个)。所以现在我需要将我的第一个机器包降级到我之前使用的版本,但我不知道那是什么版本。

话虽如此,我有什么办法可以找到升级日志,或者可能是内置的 pip 工具可以帮助我将 pandas 版本降级到以前的版本?

提前致谢

【问题讨论】:

    标签: python pandas pip version


    【解决方案1】:

    默认情况下 pip 只登录到控制台,如果你仍然打开它,你可以搜索它,以供将来参考,可以指定一个日志文件检查https://stackoverflow.com/a/53844983/3395862

    我假设你也没有使用像 git 这样的版本控制系统,所以我担心你最好的选择是安装一个与你的代码创建日期大致匹配的 pandas 版本from this list

    【讨论】:

      【解决方案2】:

      termcolor2 的示例

      C:\Users\your user>pip show termcolor2
      Name: termcolor2
      Version: 0.0.3
      Summary: simple termcolor wrapper
      Home-page: https://github.com/v2e4lisp/termcolor2
      Author: Yan Wenjun
      Author-email: mylastnameisyan@gmail.com
      License: MIT
      Location: c:\users\areza\appdata\local\programs\python\python38\lib\site-packages
      Requires: termcolor
      Required-by:
      
      # in venv
      (venv) C:\Users\your user>pip install termcolor2==0.0.2
      
      # not in venv
      C:\Users\your user>pip install termcolor2==0.0.2 -U
      ...
      

      “点子秀”帮助

      C:\Users\your user>pip show -h
      
      Usage:
        pip show [options] <package> ...
      
      Description:
        Show information about one or more installed packages.
      
        The output is in RFC-compliant mail header format.
      
      Show Options:
        -f, --files                 Show the full list of installed files for each package.
      
      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.
        --no-input                  Disable prompting for input.
        --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 15 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 PEM-encoded CA certificate bundle. If provided, overrides the default. See 'SSL
                                    Certificate Verification' in pip documentation for more information.
        --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.
        --use-feature <feature>     Enable new functionality, that may be backward incompatible.
        --use-deprecated <feature>  Enable deprecated functionality, that will be removed in the future.
      
      pip install name==version
          install a special version
      

      【讨论】:

      • pip freeze 只显示安装的版本,而不是以前的版本,所以这不起作用
      猜你喜欢
      • 2012-12-27
      • 2011-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多