问题
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?
It's a followup to the Why doesn't virtualenv on Windows associate .py/.pyw/.pyo/.pyc files with virtualenv's version of Python executables? question.
回答1:
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.
来源:https://stackoverflow.com/questions/17867214/how-to-associate-python-scripts-with-active-virtualenv