How to install virtualenv without using sudo?

后端 未结 10 519
暖寄归人
暖寄归人 2020-11-30 23:51

I have easy_install and pip.

I had many errors on my Linux Mint 12, I just re-installed it and I want to install everythin

相关标签:
10条回答
  • 2020-12-01 00:03

    http://opensourcehacker.com/2012/09/16/recommended-way-for-sudo-free-installation-of-python-software-with-virtualenv/ suggests the following:

    curl -L -o virtualenv.py https://raw.githubusercontent.com/pypa/virtualenv/master/virtualenv.py
    python virtualenv.py vvv-venv
    . vvv-venv/bin/activate
    pip install vvv
    

    It seems to work well. It lets me install https://github.com/miohtama/vvv with pip.

    If you get:

    Cannot find sdist setuptools-*.tar.gz
    Cannot find sdist pip-*.tar.gz
    

    Try --extra-search-dir after downloading the tarballs at https://github.com/pypa/virtualenv/tree/develop/virtualenv_support

    0 讨论(0)
  • 2020-12-01 00:06

    The general idea is to install virtualenv itself globaly, i.e. sudo easy_install virtualenv or sudo pip install virtualenv, but then create the actual virtual environment ("run virtualenv") locally.

    0 讨论(0)
  • 2020-12-01 00:06

    You can also use the command below, it worked for me without sudo access. You may also need to modify your PYTHONPATH environment variable using export, see this SO answer for more details.

    pip install --user virtualenv

    0 讨论(0)
  • 2020-12-01 00:06

    This worked for me:

    pip install --target=$HOME/virtualenv/ virtualenv
    cd somewhere/
    python $HOME/virtualenv/virtualenv.py env
    . env/bin/activate
    

    Now I can pip install whatever I want (except for everything that needs to compile stuff with gcc and has missing dependencies such as the python development libraries and Python.h).

    0 讨论(0)
  • 2020-12-01 00:14

    I solved my problem installing virtualenv for each user.

    python3 -m pip install --user virtualenv
    
    0 讨论(0)
  • 2020-12-01 00:16

    The easiest way I have seen so far is to install Anaconda. It may be an overkill for you. For me the centOS running on the remote server had only python2.6 installed. Anaconda by default installs everything locally + it is python2.7

    curl -O https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh
    

    Then

    bash Anaconda2-4.2.0-Linux-x86_64.sh
    

    Boom. You have all the packages like numpy and pip installed. Then if you want virtualenv, just type

    pip install virtualenv
    
    0 讨论(0)
提交回复
热议问题