我可以更改现有的 virtualenv 以忽略全局站点包吗?(比如新的 --no-site-package ) [英] Can I change an an existing virtualenv to ignore global site packages? (like --no-site-package on a new one)

查看:31
本文介绍了我可以更改现有的 virtualenv 以忽略全局站点包吗?(比如新的 --no-site-package )的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以创建一个新的 virtualenv,它使用--no-site-package"忽略全局站点包.是否可以更改现有的 virtualenv(它是在没有--no-site-package"的情况下创建的)来忽略全局站点包?(这样它就可以像最初使用--no-site-package"创建的那样工作.)

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-site-package") to also ignore the global site-packages? (So that it workes like it was created with "--no-site-package" in the first place.)

提前致谢,

塞巴斯蒂安

推荐答案

我认为你所要做的就是创建一个名为 no-global-site-packages.txt 的空文件并将其放入virtualenv 的 python2.x 文件夹(例如,lib/python2.6/,包含所有模块的文件夹).然后由 virtualenv 生成的正常 site.py 检测差异并从那里处理所有内容.

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.

这篇关于我可以更改现有的 virtualenv 以忽略全局站点包吗?(比如新的 --no-site-package )的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆