简体   繁体   English

如何在本地安装pip以与Python 2.7一起使用?

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

I want to install pip locally together with a local install of Python 2.7. 我想在本地安装pip以及在本地安装Python 2.7。 I am using an EPEL6 system on which I am not root. 我正在使用不是root用户的EPEL6系统。 I have easy_install available on the system by default (no pip or virtualenv to begin with). 默认情况下,我在系统上有easy_install (没有pipvirtualenv开头)。

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). 我已经成功安装了pip和Python 2.7,但是我不知道如何继续使用pip进行python 2.7安装(与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

I suggest using Miniconda to manage your entire Python environment. 我建议使用Miniconda来管理整个Python环境。 This way, you can avoid doing any configure / make steps, and it will come with pip by default. 这样,您可以避免执行任何configure / make步骤,并且默认情况下,它将带有pip It replaces the need for virtualenv , and can be easily installed in your home directory. 它取代了对virtualenv的需求,并且可以轻松地安装在您的主目录中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 python2.7 pip 而不是默认的 pip - how to use python2.7 pip instead of default pip 如何在安装了 python 2 & 3 的情况下使用 pip? (OSX) - How to use pip with python 2 & 3 installed? (OSX) 如何在 Python 中创建可以与 PIP 一起安装的 CLI? - How to create a CLI in Python that can be installed with PIP? 我们如何在python2.7中导入/使用python 3.4安装的库? - How we can import/use python 3.4 installed library in python2.7? 如何为 python 2.7 安装 pip? - how to install pip for python 2.7? 我在Mac上安装了python 2.7和3.6。 如何找到与Python3相关的pip版本? - I have python 2.7 and 3.6 installed on my mac. How to find the version of pip associated with Python3? 当它们安装在python2.7中时,如何为python3.x安装Numpy和pip3? 使用Conda吗? - How to install Numpy & pip3 for python3.x when they were installed in python2.7? Using Conda? 如何在 Ubuntu 20.04 中为 Python2.7 安装 pip - How can I install pip for Python2.7 in Ubuntu 20.04 如何像 npm 一样在本地使用 pip install python 包 - How to use pip install python packages locally like npm does 已安装 Python 2.7 和 Python 3.7。 如何将 MadGraph 与 Python 2.7 一起使用? - Python 2.7 and Python 3.7 installed. How to use MadGraph with Python 2.7?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM