Warning: pip is being invoked by an old script wrapper

后端 未结 6 2105
半阙折子戏
半阙折子戏 2021-02-03 23:01

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advi

6条回答
  •  旧巷少年郎
    2021-02-03 23:11

    Let me preface this by saying I am still very green with python and linux in general so I may be off base with my guidance here but I digress...

    You might want check the location of the pip module you are invoking when you use the pipcommand. for me, I found out that when I would update and modify the pip command, it would update the pip file on my ~/.local/bin directory but when I would run it, it would default to the pip command located in the /usr/local/bin directory.

    run the command

        pip install --upgrade pip
    

    for me this command returned:

    Defaulting to user installation because normal site-packages is not writeable Requirement already up-to-date: pip in ./.local/lib/python3.6/site-packages (20.1.1)

    Note the file location and version (in bold).

    check your path variables and the default pip that executes default by running the these 2 commands respectively

        echo $PATH
    

    and

        which pip
    

    god willing, they'll be congruent otherwise you'll have to either alter your the path variable directories making sure that the directory for your desired pip module is first or you'll have to delete the pip file from the director that you dont want use (i.e. the directory that came up when you ran which pip if that is not the same as the directory listed when you updated pip)

    For me, removing the pip files in the usr/local/bin worked like a charm. Also check that the pip files that you want to use are referencing the correct version of python at the top of their scripts

    #!/usr/bin/python3
    
    # -*- coding: utf-8 -*-
    import re
    import sys
    
    from pip._internal.cli.main import main
    
    if __name__ == '__main__':
        sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
        sys.exit(main())
    

    The other file originally referenced usr/bin/python (Python 2.7) instead of usr/bin/python3 (python 3.6.9) as I wanted initially.

    Like I said before, I am just getting started with linux and python so take this with a grain of salt. Nevertheless, I no longer get this pip warning after taking these steps. Let me know if this helps at all.

提交回复
热议问题