Home >Backend Development >Python Tutorial >How do I Specify the Python Version When Creating a Virtual Environment with virtualenv?

How do I Specify the Python Version When Creating a Virtual Environment with virtualenv?

DDD
DDDOriginal
2024-12-16 15:02:11356browse

How do I Specify the Python Version When Creating a Virtual Environment with virtualenv?

Creating Virtual Environments for Specific Python Versions with virtualenv

Problem: How do I specify the Python version for a virtual environment using virtualenv?

Answer:

Prior to Python 3.3, virtualenv users could specify the Python executable they wanted to use by employing the --python (or short -p) option during the creation of a virtualenv instance. For instance:

virtualenv --python="/usr/bin/python2.6" "/path/to/new/virtualenv/"

Note: For Python versions 3.3 and later, refer to the response provided by Aelfinn (included below for reference).

The above is the detailed content of How do I Specify the Python Version When Creating a Virtual Environment with virtualenv?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn