in virtual environment pip installs in global instead of virtual environment on Windows 10
See original GitHub issueDescription
When I create a virtual environment with venv:
py -m venv my_env
and activate it, pip installs packages in the global site-packages of current python instead of venv site-packages
I used pip install <package>
and path/to/my_env/Scripts/python.exe -m pip install <package>
but none of them worked.
I googled and checked activate file and the path was ok. Also a manual solution for every environment does not work for me as I want to use ‘Pycharm env’ and install platformio for vscode (as it first create virtual env then starts installing packages)
I even reinstalled my python but it didn’t worked. I don’t know if it’s related to pip.ini setting.
I have no idea what to do…
Expected behavior
I expected pip to install packages in path/to/my_env/Lib/site-packages instead of glabal python site-packages
pip version
22.0.4 (in virtual env, global is 22.1.1)
Python version
3.9.13
OS
Windows_NT, 10.0.19044, x64
How to Reproduce
py -m venv my_env [or ‘py -m virtualenv my_env’] my_env\Scripts\activate.bat pip install Django [or ‘my_env\Scripts\python.exe -m pip install Django’]
Output
No response
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Issue Analytics
- State:
- Created a year ago
- Comments:10 (7 by maintainers)
Top GitHub Comments
That was strange for me too. I had noticed that but I thought it was the default setting. Anyway removing pip.ini in the specified directory actually solved my problem! Thank you very much for your help!
Oh, I misread your previous comment! You were talking about disallowing setting those configs; I was thinking about let pip not run with those configs.