Timeline for Use different Python version with virtualenv
Current License: CC BY-SA 4.0
35 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 20, 2022 at 6:37 | history | edited | Mateen Ulhaq | CC BY-SA 4.0 |
Reorder notice.
|
| Apr 26, 2021 at 1:20 | comment | added | mattsmith5 | this will work work for Windows stackoverflow.com/a/22793687/15435022 | |
| Dec 8, 2020 at 19:48 | comment | added | Stefan |
If you are a lot lazy, just: </path/to/python/you/want/to/use> -m venv <path/to/new/virtualenv/>
|
|
| May 9, 2020 at 9:52 | comment | added | Rahul Bali | This is the best solution even for Python 3 or newer. | |
| Aug 5, 2019 at 13:18 | comment | added | Gokul |
use which python or which python3 to find the path of the python.
|
|
| Apr 21, 2019 at 6:20 | comment | added | m.a.d.cat |
II like to add virtualenv --no-site-packages --python=/usr/bin/python3.6 .
|
|
| Dec 26, 2018 at 1:01 | comment | added | user9826550 |
if not sure, go like virtualenv --python=which python3 venvdir # can be existing one, even with pycharm project loaded in the ide
|
|
| S Dec 4, 2018 at 19:54 | history | suggested | wjandrea | CC BY-SA 4.0 |
remove noise
|
| Dec 4, 2018 at 18:52 | review | Suggested edits | |||
| S Dec 4, 2018 at 19:54 | |||||
| Aug 1, 2018 at 18:17 | comment | added | Radek | Perfect, it works, if you want to keep always the brew version make sure you use path "/usr/local/bin/python", thank you | |
| Nov 14, 2017 at 13:54 | comment | added | Alex Punnen | If you are in Ubuntu 16.04 or other and getting errors please see the accepted answer here - stackoverflow.com/questions/37495375/… It works and does not harm the OS (usually any uninstall of python in ubuntu is bad) | |
| Sep 16, 2017 at 21:12 | history | edited | Rotareti | CC BY-SA 3.0 |
The venv module was added with Python 3.3, so I tought it would be good to adjust this :)
|
| May 24, 2017 at 16:22 | history | edited | David Ferenczy Rogožan | CC BY-SA 3.0 |
Added a long option since it's more descriptive.
|
| May 23, 2017 at 12:10 | history | edited | URL Rewriter Bot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
| Mar 31, 2017 at 15:52 | history | edited | Michael Scheper | CC BY-SA 3.0 |
Added reference link for Python 3.6
|
| Nov 20, 2016 at 15:30 | comment | added | Michael | virtualenv -p $(which python3) <path/to/new/virtualenv/> | |
| Aug 28, 2016 at 22:27 | comment | added | Charlie Parker | Is there no solutions that switches between python versions without requiring to create a new virtual environment? | |
| Aug 5, 2016 at 20:58 | comment | added | Chris Johnson |
See my answer below for an equivalent solution using environment variables. That approach means you don't have to remember to use -p.
|
|
| Aug 5, 2016 at 20:37 | comment | added | Chris Johnson |
The -p / --python option also works with virtualenvwrapper functions, like mkproject.
|
|
| May 10, 2016 at 11:29 | history | edited | gsamaras | CC BY-SA 3.0 |
added 2 characters in body
|
| Jan 12, 2016 at 17:32 | comment | added | user1807271 | When using pip after the duel installation do you have to specify which python pip is to use? (example 'python2.7 -m pip install SomePackage # specifically Python 2.7') or will pip in that virtualenv automatically know which one to use? | |
| Mar 26, 2015 at 9:51 | comment | added | DanH | pythonbrew is no longer maintained, use pyenv instead. | |
| Oct 16, 2013 at 0:57 | comment | added | blaze |
If you are a tad lazy: virtualenv -p `which python2.6` <path/to/new/virtualenv>
|
|
| Jul 22, 2013 at 9:18 | history | edited | Piotr Dobrogost | CC BY-SA 3.0 |
added 26 characters in body
|
| May 19, 2013 at 0:38 | comment | added | Derek Morrison | @John C Yes (to Daniel's point), it seems the point of virtualenv is to take a global Python executable and maintain separate sets of packages. This is different from, say, Ruby's RVM, which is designed to keep a separate version of Ruby as well as a set of gems in one environment. | |
| Feb 9, 2013 at 4:51 | review | Suggested edits | |||
| Feb 9, 2013 at 4:57 | |||||
| Dec 1, 2011 at 22:03 | comment | added | ashwoods | @JohnC You can use pythonbrew to install alternative pythons. | |
| S Jul 4, 2011 at 9:49 | history | suggested | Kenneth Reitz | CC BY-SA 3.0 |
Absolute path makes the usage clearer.
|
| Jul 4, 2011 at 9:26 | review | Suggested edits | |||
| S Jul 4, 2011 at 9:49 | |||||
| May 24, 2011 at 14:47 | comment | added | Daniel Roseman | @John yes, you are. That isn't the point of virtualenv: the point of that is to create a sandboxed environment for Python. You will need to install that version first - you can install it locally for your user, though. | |
| May 24, 2011 at 14:31 | comment | added | John C | I'm missing something here - doesn't this require that 2.6 already be installed on the system? I thought the point of virtualenv was that I could have a version of python other than the main one (in my case, 2.4 on CentOS). I was assuming I could install virtualenv, then install Python 2.6 under it for packages in the env to make use of? | |
| Jan 6, 2011 at 22:19 | vote | accept | Ulf | ||
| May 28, 2010 at 3:24 | comment | added | bias | I figured I'd mention that this works for virtualenvwrappers too: mkvirtualenv -p python2.6 env | |
| Oct 7, 2009 at 21:55 | vote | accept | Ulf | ||
| Oct 7, 2009 at 22:27 | |||||
| Oct 7, 2009 at 21:33 | history | answered | Daniel Roseman | CC BY-SA 2.5 |