1

I have miniconda installed on my new Mac at:

/opt/miniconda3/bin/python

My .zsh terminal shows the default Python as 2.7:

Python 2.7.16 (default, Dec 21 2020, 23:00:36) 
[GCC Apple LLVM 12.0.0 (clang-1200.0.30.4) [+internal-os, ptrauth-isa=sign+stri on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

I am trying to create a venv for a project I want to work on in VSCode. I am navigating to the folder and typing:

20:38:54:~/Documents/Python_Projects/pword_proj % pip3 install virtualenv

and I get this error:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

I also tried:

20:39:40:~/Documents/Python_Projects/pword_proj % pip install virtualenv 

and I get this error:

zsh: command not found: pip

I am not sure what I am doing incorrect here. Thanks

JD2775
  • 3,658
  • 7
  • 30
  • 52

2 Answers2

2

Python version 2.7 has been depreciated and so pip3 is now being used. You can try installing virtualenv with brew:

brew install pyenv-virtualenv

You can install home-brew here https://brew.sh

You may also need to reinstall the CommandLineTools using:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
Jacob Anderson
  • 1,747
  • 1
  • 12
  • 17
  • Thanks Jacob. I don't understand brew at all, I tried installing it when I got the laptop and made a mess of it so I removed it. I think the second part of your answer may be the issue from what I am googling around. Maybe Ill try that sudo command, it's possible the last Mac OS update screwed up those tools – JD2775 Mar 06 '21 at 04:55
  • What types of problems did you have when you tried to install brew originally? – Jacob Anderson Mar 06 '21 at 04:59
  • I don't remember to be honest, just a bunch of error messages trying to get it installted correctly. I don't know why. Anyway, your Xcode fix seems to have resolved the issue. At least pip is working now. Thanks Jacob – JD2775 Mar 06 '21 at 05:06
2

If you already have miniconda installed, I do not believe you need virtualenv since miniconda allows you to use conda environments. Conda does what virtualenv can do and more.

You can learn more about managing conda environments here. To create a conda environment, you can use the following command.

conda create --name myenv

That being said, it seems that your shell is not recognizing the pip command. This may be due to not being in your base conda environment, so enable that by using

source activate

If pip still isn't found after that, I would recommend checking your environment variables under PATH.

joshua
  • 458
  • 5
  • 18