Virtualenv keeps loading global site packages on Windows

前端 未结 3 593
[愿得一人]
[愿得一人] 2021-02-06 07:49

I\'ve looked around on SO, and the answers I have found to my problem haven\'t allowed me to solve it yet.

I want to use isolated virtualenv environments, but for one re

3条回答
  •  Happy的楠姐
    2021-02-06 08:05

    A little bit of extra .bat hackery can easily fix this. My standard additions to activate.bat are:

    REM custom venv settings
    set PYTHONPATH=%\VIRTUAL_ENV%;%\VIRTUAL_ENV%\conf;%\VIRTUAL_ENV%\apps
    set DJANGO_SETTINGS_MODULE=settings
    
    ftype Python.File=%VIRTUAL_ENV%\Scripts\python.exe %1 %*
    

    and to deactivate.bat

    REM restore ftype
    ftype Python.File=C:\tools\Python27\python.exe %1 %*
    

提交回复
热议问题