Why are my Python packages being installed to this strange folder?

  pip, python, windows

I am encountering issues with installing certain Python modules on Windows, using pip. In particular, I am using Flask, but I am encountering the error 'flask' is not recognized as an internal or external command,
operable program or batch file.
in command line.

However, I am able to run my code properly with python -m flask run for some reason. After investigating, I figured there was a problem with my installation of Flask, so I did pip install --upgrade --force-reinstall flask to hopefully fix the issue. I then encounter the warning message: the script flask.exe is installed in 'C:UsersNameAppdataLocalPackagesPythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0LocalCachelocal-packagesPython38Scripts' which is not on PATH.

Why would my package be installed to this location? My understanding is the default location for a package installation should be C:UsersNameAppDataLocalProgramsPythonPython38Lib instead. How can I fix this. It seems all my packages are being installed to this strange folder, which is giving me countless issues. I have tried force upgrading pip, and reinstalling python to no avail.

Source: StackOverflow

LEAVE A COMMENT