I've installed Python 3.5 using Anaconda and 2.7 using the following command:
conda create -n py27 python=2.7 anaconda
This successfully installed 2.7 as a separate environment with the Anaconda3 folder:
# original installation path for 3.5
C:\Users\username\AppData\Local\Continuum\Anaconda3
# path for 2.7 after conda create -n is run
C:\Users\username\AppData\Local\Continuum\Anaconda3\envs\py27
This works great as long as I'm using an IDE like Spyder or IPython Notebook, where I can choose which Python version. However, I have not been able to use py27 (Python 2.7) in the PowerShell. I've tried using:
activate py27
yet python command still fires up 3.5 and py27 causes this error:
py27 : The term 'py27' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1 + py27
+ ~~~~
+ CategoryInfo : ObjectNotFound: (py27:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I've tried everything I know or have read here on SO, but nothing I've tried has been able to resolve the issue. I'm not sure if this helps, but here is my PATH variable for reference:
C:\Users\username\AppData\Local\Continuum\Anaconda3;C:\Users\username\AppData\Local\Continuum\Anaconda3\Scripts;C:\Users\username\AppData\Local\Continuum\Anaconda3\Library\bin;%SystemRoot%\system32\WindowsPowerShell\v1.0\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;[stuff in between];C:\Users\username\AppData\Local\Continuum\Anaconda3\envs\p27;C:\Users\username\AppData\Local\Continuum\Anaconda3\envs\p27\Scripts\;C:\Users\username\AppData\Local\Continuum\Anaconda3\envs\p27\Library\bin
activate? If it is a batch file, the environment variables it sets will not propagate to PowerShell. To fix this, you can use theInvoke-CmdScriptfunction from this article.activateis the command I found here on SO, to "activate" the2.7environment within the Anaconda3 installation. It is the most common solution I read on the forum. However, even though the command ran with no problem in the PowerShell, it didn't actually allow me to run2.7from the command line. Here is an example post hereactivateis a batch file (cmd.exe shell script) and it sets environment variables, you will need to run it using theInvoke-CmdScriptfunction in the article.Invoke-CmdScriptfunction in the aforementioned article.Invoke-CmdScriptfunction. At this point, I ran the commandInvoke-CmdScript .\activate.bat. I get'.\activate.bat' is not recognized as an internal or external command, operable program or batch file.in return.