Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

15
  • 21
    Glad you pointed that out, it needs more promotion. One minor nit: they are now advocating running it as python3 -m venv <envname> to prevent needing stub scripts for everything. Commented Nov 20, 2016 at 16:08
  • 7
    In fact the pyvenv script is deprecated in Python 3.6+, though the underlying venv module itself is not. So use python 3 -m venv <myenvname> as @PaulEveritt says. Commented Dec 20, 2016 at 8:47
  • 7
    Be warned that pyvenv or python3 -m venv ... do NOT install the python-config script. This means that even after activating your Python3 environment the system-wide python-config will be invoked with confusing consequences. See this bug report from 2011 github.com/pypa/virtualenv/issues/169 and my question stackoverflow.com/questions/42020937/… Commented Feb 23, 2018 at 11:16
  • 52
    Confirming that @Nick's observation works: The way to create a venv with a specific Python version is by using that version when setting it up. For example: python3.5 -m venv venv Commented Oct 21, 2019 at 21:35
  • 28
    It's still possible to use a different python version with venv. Instead of providing an argument, like with virtualenv, you just be sure to use the appropriate python version to run venv. Example with py the python launcher: py -3.3 -m venv my_venv will create a virtual environment using python 3.3. Commented May 12, 2020 at 20:22