如何在本地安装pip以与Python 2.7一起使用? [英] How can pip be installed locally for use with Python 2.7?

查看:110
本文介绍了如何在本地安装pip以与Python 2.7一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在本地安装pip以及Python 2.7的本地安装.我正在使用不是root用户的EPEL6系统.默认情况下,我在系统上有easy_install可用(开头没有pipvirtualenv).

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).

我已经成功安装了pip和Python 2.7,但是我不知道如何继续进行pip与python 2.7安装(相对于python 2.6)的工作.

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

推荐答案

我建议使用 Miniconda 来管理整个Python环境.这样,您可以避免执行任何configure/make步骤,并且默认情况下它将随pip一起提供.它取代了virtualenv的需要,并且可以轻松地安装在您的主目录中.

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.

这篇关于如何在本地安装pip以与Python 2.7一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆