将virtualenv从3.5.3降级到2.7 [英] Downgrade virtualenv to 2.7 from 3.5.3

查看:117
本文介绍了将virtualenv从3.5.3降级到2.7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的virtualenv当前配置为python 3.5.0,而我需要使用的软件包仅支持2.7。我需要一种在virtualenv中将python运行时降级到2.7的方式。

 (项目)me-Air:element me $ python -V 
Python 3.5。 0

me-Air:element me $ python -V
Python 2.7.10


解决方案

您不能降级 virtualenv。



您将不得不创建一个新的虚拟环境。除非您希望virtualenv具有与当前名称相同的名称,否则不必删除当前的名称。



virtualenv -p / usr / bin / python2.7< path / to / new / virtualenv />



由于您的问题要求将它们集成在一起,因此有很多方法,请使用子进程使用Python进行所需的操作2.7代码并将输出传输回您的Python 3代码。



您还可以使用 Rabbit MQ队列,用于与运行不同版本的Python的程序之间进行数据传输。


My virtualenv is currently configured to python 3.5.0 while the package I need to use only supports 2.7. I need a way of downgrading my python runtime to 2.7 within my virtualenv.

I do have both versions available to use: First one is in my virtualenv, second is computer-wide.

(project) me-Air:element me$ python -V
Python 3.5.0

me-Air:element me$ python -V
Python 2.7.10

解决方案

You cannot "downgrade" virtualenv.

You will have to create a new one, you don't necessarily need to delete your current one unless you want the virtualenv to have the same name as your current one.

virtualenv -p /usr/bin/python2.7 <path/to/new/virtualenv/>

Since your problem requires them to be integrated there are many ways to do it, use subprocess to do whatever you need to with the Python 2.7 code and transfer the output back to your Python 3 code.

You could also use Rabbit MQ Queues to transfer data to and from the programs running different versions of Python.

这篇关于将virtualenv从3.5.3降级到2.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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