How can pip be installed locally for use with Python 2.7?

点点圈 提交于 2019-12-10 12:07:53

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!