Can I change an an existing virtualenv to ignore global site packages? (like --no-site-package on a new one)

前端 未结 2 1169
有刺的猬
有刺的猬 2020-12-30 05:36

I can create a new virtualenv that ignores global site-packages with \"--no-site-package\". Is it possible to change an existing virtualenv (which was created without \"--no

相关标签:
2条回答
  • 2020-12-30 06:15

    I think all you have to do is create an empty file called no-global-site-packages.txt and put it into the virtualenv's python2.x folder (eg, lib/python2.6/, the one with all the modules). Then the normal site.py generated by virtualenv detects the difference and handles everything from there.

    0 讨论(0)
  • 2020-12-30 06:29

    Can you just create a new one and then re-create it with the --no-site-package? If you use pip then you can use pip freeze > requirements.pip to generate a requirements file to re-install into your new virtualenv.

    0 讨论(0)
提交回复
热议问题