1

I have a Python installation in C:\ProgramData\Anaconda2 and C:\ProgramData\Anaconda3. I would like to create a virtual environment using base Python (not anaconda) in C:\ProgramData. My question is two fold.

  1. Can I use a python instance as the base for the new env that has not been installed? I.e. A clean version of base Python without Anaconda? Or, do I have to download and install that first in a third directory and then use that?
  2. Can I specify which instance of python to use as the base when setting up the env? I.e from directory C:\ProgramData\ >> $ virtualenv my_project --C:\ProgramData\Python27? So in this example the new virtual environment would be created in C:\ProgramData\My_Project and use the clean base version of python instead of the Anaconda 2 or 3 distribution?

Thank you in advance.

Pandas
  • 75
  • 1
  • 4
  • Possible duplicate of [Use different Python version with virtualenv](https://stackoverflow.com/questions/1534210/use-different-python-version-with-virtualenv) – phd Aug 02 '17 at 17:12

2 Answers2

1

You can do virtualenv -p "path to python executable(whichever you want)"

Stack
  • 4,116
  • 3
  • 18
  • 23
  • Perfect, thank you! And is there any way to specify which packages will be inherited from that instance or it will be a clean slate? – Pandas Aug 02 '17 at 14:29
  • it will be clean new version, you have to use pip/easy_install to install the packages again in the virtualenv – Stack Aug 02 '17 at 14:30
  • sounds good, thank you. I'll accept your answer after the cooldown. – Pandas Aug 02 '17 at 14:31
1

Can I specify which instance of python to use as the base when setting up the env?

Of course, just run virtualenv -p P:\ath\to\python.exe

As for your other question -- the python install which you want to use has to exist locally, afaik. So you'd have to install python first, if you don't want to use the version provided by anaconda.

azrdev
  • 225
  • 1
  • 13