Can't pip install virtualenv in OS X 10.8 with brewed python 2.7

前端 未结 5 779
隐瞒了意图╮
隐瞒了意图╮ 2020-12-09 06:00

When trying to install virtualenv using a brewed python, I get the following error:

$ pip install virtualenv
Requirement already satisfied (use --upgrade to          


        
5条回答
  •  感情败类
    2020-12-09 06:51

    I found that unlike you my paths were wrong according to brew doctor. But after correcting that I still had the issue (no surprises given your description) so I uninstalled virtualenv then reinstalled but this time with sudo, sudo pip install virtualenv

    This resolved the issue, which indicates that I've either got another problem with the system configuration in general or someone who has more then my one hour of Python experience will be able to point out why it's not good (I think it's related to global installing being considered a bad practice).

    Seth is onto something with which seems you see the same as me,

    ~ which python results in /usr/local/bin/python

    ~ ls -l /usr/local/bin/python gives me _permissions_etc_ /usr/local/bin/python -> ../Cellar/python/2.7.5/bin/python

    Pip

    which pip pointed to /usr/local/bin/pip

    ls -l /usr/local/bin/pip shows _permissions_etc_ /usr/local/bin/pip -> ../Cellar/python/2.7.5/bin/pip

    Virtualenv (I don't have an output prior to the sudo pip install)

    which virtualenv is /usr/local/bin/virtualenv

    ls -l /usr/local/bin/virtualenv shows _permissions_etc_ /usr/local/bin/virtualenv

    When I created and use a virtualenv I get the following,

    workon ve_test
    which python
    /Users/_username_/.virtualenvs/ve_test/bin/python
    (ve_test)➜  ~PIP_VIRTUALENV_BASE  python --version
    Python 2.7.5
    

    FWIW my .zshrc has the following,

    # Python related
    # http://hackercodex.com/guide/python-virtualenv-on-mac-osx-mountain-lion-10.8/
    # http://docs.python-guide.org/en/latest/dev/virtualenvs.html
    source /usr/local/bin/virtualenvwrapper.sh
    # virtualenv should use Distribute instead of legacy setuptools
    export VIRTUALENV_DISTRIBUTE=true
    # Centralized location for new virtual environments
    export PIP_VIRTUALENV_BASE=$HOME/Projects/PythonVirtualEnv
    # cache pip-installed packages to avoid re-downloading
    export PIP_DOWNLOAD_CACHE=$HOME/.pip/cache
    

提交回复
热议问题