-1

My Mac has python 3.10.5, and I have created a virtual environment which has python 3.8.5, now I want to create another virtual environment with python 3.7, I have searched online for a while, most ppl would suggest using pyenv, but I am pretty sure my python 3.8.5 virtual environment is installed without pyenv, I only used virtualenv.


sky@Skys-MBP ~ % python -V
Python 3.10.5
sky@Skys-MBP ~ % cd environments 
sky@Skys-MBP environments % ls
bin     coursera    lib     python3.8env    pyvenv.cfg  screenshots share
sky@Skys-MBP environments % source python3.8env/bin/activate
(python3.8env) sky@Skys-MBP environments % python -V
Python 3.8.5
(python3.8env) sky@Skys-MBP environments % deactivate
sky@Skys-MBP environments % 
sinoroc
  • 18,409
  • 2
  • 39
  • 70
Sky
  • 2,212
  • 3
  • 14
  • 22
  • 1
    Install the Python version you want to have and `/path/to/your/python/binary -m venv ...`. – Klaus D. Nov 02 '22 at 04:31
  • @KlausD. How do I install python in at specific folder only ? – Sky Nov 02 '22 at 05:13
  • You need to install Python globally. You can install as many Python interpreters as you want. -- "Installing in a specific folder only" is not a concept that exists for Python, as far as I know. But for sure there must be some extra additional tooling somewhere that might help get in that direction. -- Not sure if `pyenv` can help you here for your specific use cases, you should try it. -- Anyway, the sure thing is that `virtualenv` requires the Python interpreter to be installed and operational beforehand. – sinoroc Nov 02 '22 at 09:35

1 Answers1

0
  1. find out the path where your python version is installed

  2. run below

    virtualenv -p /your/python/path/python2.6 foldernamehere

Sky
  • 2,212
  • 3
  • 14
  • 22