Windows reports error when trying to install package using pipenv

前端 未结 8 2016
借酒劲吻你
借酒劲吻你 2021-02-03 22:56

I installed pipenv by following the instructions here. From the Windows command prompt I ran

pip install --user pipenv

which returned the mess

8条回答
  •  终归单人心
    2021-02-03 23:25

    python -m pipenv may work for you, this is telling python to run the module pipenv instead of the terminal shortcut which sometimes doesn't install properly.

    Just to show they are equivalent when I installed pipenv and run which pipenv it points to a file like /Library/Frameworks/Python.framework/Versions/3.6/bin/pipenv which looks like this:

    #!/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6
    
    # -*- coding: utf-8 -*-
    import re
    import sys
    
    from pipenv import cli
    
    if __name__ == '__main__':
        sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
        sys.exit(cli())
    

    so it removes .pyw or .exe from the executable name then call pipenv.cli.cli(). It is likely there is a file like this on your machine it just didn't add python's /bin folder to your system PATH so it isn't accessible, there is usually a warning when installing python if this happens but no one checks those. :P

    the module pipenv.__main__ which is run when using python -m pipenv looks like this:

    from .cli import cli
    
    if __name__ == '__main__':
        cli()
    

    Which calls pipenv.cli.cli(). So this main module absolutely does the same effective thing.

提交回复
热议问题