问题
I want to install pip
locally together with a local install of Python 2.7. I am using an EPEL6 system on which I am not root. I have easy_install
available on the system by default (no pip
or virtualenv
to begin with).
I have managed to install pip and Python 2.7, but I don't know how to proceed to get pip
working with the Python 2.7 install (as opposed to Python 2.6).
cd
mkdir local_test
cd local_test
wget https://www.python.org/ftp/python/2.6/Python-2.6.tgz
tar -xvf Python-2.6.tgz
cd Python-2.6
./configure --prefix=/home/user/local_test
make
make install
cd ..
rm -rf Python-2.6
rm Python-2.6.tgz
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
tar -xvf Python-2.7.12.tgz
cd Python-2.7.12
./configure --prefix=/home/user/local_test
make
make install
cd ..
rm -rf Python-2.7.12
rm Python-2.7.12.tgz
export PYTHONPATH=/home/user/local_test/lib/python2.6/site-packages:${PYTHONPATH}
easy_install --prefix=~/local_test pip
export PATH=/home/user/local_test/bin:$PATH
回答1:
I suggest using Miniconda to manage your entire Python environment. This way, you can avoid doing any configure
/make
steps, and it will come with pip
by default. It replaces the need for virtualenv
, and can be easily installed in your home directory.
来源:https://stackoverflow.com/questions/42537722/how-can-pip-be-installed-locally-for-use-with-python-2-7