如何将 Python 脚本与活动的 virtualenv 相关联? [英] How to associate Python scripts with active virtualenv?

查看:44
本文介绍了如何将 Python 脚本与活动的 virtualenv 相关联?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我激活特定的 virtualenv 之后,我希望使用来自 virtualenv 的 Python 解释器执行 Python 脚本,我只使用它们的名称 (script.py) 运行这些脚本.如何做到这一点?

After I activate specific virtualenv I'd like to have Python scripts, which I run using only their name (script.py), be executed using Python interpreter from virtualenv. How to do this?

这是 为什么 Windows 上的 virtualenv 不将 .py/.pyw/.pyo/.pyc 文件与 virtualenv 的版本相关联的后续Python 可执行文件? 问题.

推荐答案

感谢 Vinay SajipPython Launcher(也称为 pylauncher)和这个 commitPaul Moorea 制作> 我们现在可以享受在活动 virtualenv 的上下文中运行 Python 脚本!此功能计划包含在与 Python 3.4 捆绑的 Python Launcher 中.

Thanks to great work of Vinay Sajip, creator of Python Launcher (also called pylauncher) and this commit made by Paul Moore we can enjoy running Python scripts in the context of active virtualenv now! This feature is planned to be included in Python Launcher bundled with Python 3.4.

这篇关于如何将 Python 脚本与活动的 virtualenv 相关联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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