简体   繁体   English

在centos 6上安装了Python2.7,现在pip指向Python2.7而不是Python版本

[英]Installed Python2.7 on centos 6 and now pip points to Python2.7 instead of Python version

我已经在centos 6 linux框中安装了python 2.7,当我使用easy_install和pip安装任何软件包时,请在Python2.7中安装它的安装...我需要在默认的Python2.6中安装一些软件包,我该怎么做?

You can check your pip version and which python it is pointed to 您可以检查您的pip版本以及指向的python

pip --version

That should give you some information about what to expect when calling pip. 那应该给您一些有关点子呼叫时的预期信息。 If you have pip 0.8 or better you can try pip-{version} . 如果您的pip为0.8或更高,则可以尝试pip-{version}

pip-2.6 install some-package-you-want-in-2.6
pip-2.7 install some-package-you-want-in-2.7

If you are still having problems you are calling the correct version of python. 如果仍然有问题,请调用正确版本的python。 Check that your $PYTHON_PATH env var points to Python 2.6. 检查您的$ PYTHON_PATH env var指向Python 2.6。

echo $PYTHON_PATH

Will tell you where it is pointed at now. 会告诉您现在的位置。 The value is likely set in your ~/.bashrc file. 该值可能在您的〜/ .bashrc文件中设置。 If that comes back blank you should set the PYTHON_PATH variable so you can easily configure what Python you are calling from the shell. 如果返回空白,则应设置PYTHON_PATH变量,以便可以轻松配置要从Shell调用的Python。 Without the variable you shell will call the python linked in /usr/bin, changing the symlinking in /usr/bin which might give you headaches down the road because you'll be altering global behavior in your system. 没有变量,您的外壳程序将调用/ usr / bin中的python链接,更改/ usr / bin中的符号链接,这可能使您头痛不已,因为您将更改系统中的全局行为。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM