Cannot “sudo pip uninstall” operation not permitted (/tmp) in OS X El Capitan

后端 未结 2 556
小鲜肉
小鲜肉 2021-01-02 16:59

Preface: My OS X Python installation is a mess. I started using the system Python way before I found out about Homebrew. And so I\'ve been using sudo

2条回答
  •  [愿得一人]
    2021-01-02 17:39

    Don't use Homebrew nor MacPorts, nor the builtin Python. These are nested solutions that will eventually fail, one way or another (PEP20: flat is better than nested). At the very least, you will have to wait for the package management system to notice any PyPI updates, or fall back to using pip as you would have done anyway without any package manager. Use MacPorts to install only non-Python items that need to compile and be customized (e.g., ATLAS).

    The simplest thing to do is to install a stand-alone Python from python.org (either from a binary distribution, or build from source). No sudo, install under your user. Then:

    pip install -U pip setuptools virtualenvwrapper
    

    Source your wrapper from your ~/.bashrc per their docs, and makevirtualenv foo. All other work will be performed in virtual environments only. If you use Python 3, then virtualenv is part of the interpreter, so you don't need virtualenvwrapper and the little dance related to it.

提交回复
热议问题