Pip installing packages in global environment instead of virtualenv on Windows

社会主义新天地 提交于 2020-07-19 04:39:51

问题


I am using pycharm and for that i am using python virtualenv.

I activate virtualenv using penv\Scripts\activate.bat command. But when i run pip install requests, it is getting installed in global folder instead of local virtualenv folder. I am not able to understand why is the case so.

Output of where python is as follow:

E:\app-backend\penv\Scripts\python.exe
C:\Users\Hardik\AppData\Local\Programs\Python\Python37\python.exe

Output of where pip is as follow:

E:\app-backend\penv\Scripts\pip.exe
C:\Users\Hardik\AppData\Local\Programs\Python\Python37\Scripts\pip.exe

I have tried it again and again but it always installs any package in global folder. But when I run any command using E:\app-backend\penv\Scripts\pip.exe install of pip, it installs that package in local virtualenv.

Can anyone tell me what is the case happening here?


回答1:


You should run python from your virtual enviromment. For example:

E:\app-backend\penv\Scripts\python.exe -m pip list

But you should activate your venv first:

E:\app-backend\penv\Scripts\activate


来源:https://stackoverflow.com/questions/56708993/pip-installing-packages-in-global-environment-instead-of-virtualenv-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!