Thursday 7 April 2022

mac brew install specific python version

 

  1. Install the required version:

     % brew install python@3.7
     % brew list | grep python
     % brew ls python@3.7
     % ls -l /usr/local/Cellar/python@3.7/3.7.8_1/bin/python3.7
    
  2. Add a soft link to /usr/local/bin/:

     % ln -s /usr/local/Cellar/python@3.7/3.7.8_1/bin/python3.7 /usr/local/bin/python3.7
     % python3.7 -V
    
  3. Create a Python virtual environment:

     % python3.7 -m venv venv37
    
  4. Enter the virtual environment:

     % source venv37/bin/activate
    
  5. Exit the virtual environment:

     % deactivate

No comments:

Post a Comment