I have a Flask app that with and using venv for my virtual environment. For some reason, which pip
has suddenly stopped installing packages in venv/lib/python3.9/site-packages
, but to a completely different repository on my system. How do I redirect pip to install packages to the correct path in venv?
Asked
Active
Viewed 80 times
-1

davidism
- 121,510
- 29
- 395
- 339

MightyModest
- 1
- 3
-
use `path/to/venv/bin/python -m pip install ...` https://snarky.ca/why-you-should-use-python-m-pip/ – sinoroc Feb 17 '23 at 09:23
2 Answers
0
instead of using pip
as a stand alone command in terminal, i suggest you to use python -m pip
instead, here python will be assoicated with the project (in case of Virtual environment) or whole system level (in case docker single app ). This will keep track and tell the system to run all package/module related to python interpreter assoicated with the project only

sahasrara62
- 10,069
- 3
- 29
- 44
-1
You can use the -t flag provided by the pip install command.
pip install <package_name> -t <full_location_path>

Nolan Walker
- 352
- 1
- 7
-
Would suggest looking at this link if you want to set a permanent path: https://stackoverflow.com/questions/24174821/how-to-change-default-install-location-for-pip – Nolan Walker Feb 17 '23 at 05:21