现有的 virtualenv 可以优雅地升级吗? [英] Can existing virtualenv be upgraded gracefully?

查看:71
本文介绍了现有的 virtualenv 可以优雅地升级吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个为 Python 2.5 创建的 virtualenv,想将它升级"到 Python 2.6.

I have a virtualenv created for Python 2.5 and want to "upgrade" it to Python 2.6.

这是它最初的设置方式:

Here is how it was originally set up:

virtualenv --no-site-packages -p python2.5 myenv

我现在在同一目录中运行 virtualenv 进行升级:

I now run virtualenv in the same directory to upgrade:

virtualenv --no-site-packages -p python2.6 myenv
...
Not overwriting existing python script myenv/bin/python (you must use myenv/bin/python2.6)
...
Overwriting myenv/bin/activate with new content

默认python仍然是2.5,尽管我也可以指定2.6.有什么办法可以完全删除 2.5 并让bin/python"指向 2.6?

The default python is still 2.5, even though I can also specify 2.6. Is there any way to remove 2.5 entirely and have 'bin/python' point to 2.6 instead?

推荐答案

您可以使用 Python 2.6 virtualenv 来重新虚拟化"现有目录.不过,您必须重新安装您安装的所有模块.我经常有一个用于开发模块的虚拟目录,virtualenv 与许多版本的 Python 位于同一目录,它工作得很好.:)

You can use the Python 2.6 virtualenv to "revirtual" the existing directory. You will have to reinstall all the modules you installed though. I often have a virtual directory for developing a module, and virtualenv the same directory with many versions of Python, and it works just fine. :)

这篇关于现有的 virtualenv 可以优雅地升级吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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