我在我的centOS
服务器上安装了两个版本的Python
。
[ethan@demo ~]$ python2.6 --version
Python 2.6.6
[ehtan@demo ~]$ python --version
Python 2.7.3
一些重要的centOS
软件包需要较旧版本(2.6),因此我无法删除它。
使用pip
安装软件包时,它们将被安装在Python 2.6
中。然而,我希望它们被安装到Python 2.7
中。
我该如何改变这种行为呢?
例如,当我尝试安装Wand
时,以下是发生的情况:
[ethan@demo ~]$ pip install Wand
Requirement already satisfied (use --upgrade to upgrade): Wand in /usr/lib/python2.6/site-packages
Cleaning up...
[ethan@demo ~]$ python2.6
Python 2.6.6 (r266:84292, Jul 10 2013, 22:48:45)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wand
>>> exit()
[ethan@demo ~]$ python
Python 2.7.3 (default, Oct 11 2013, 15:59:28)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wand
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named wand
>>> exit()
编辑
我找到了这个答案,但它对我没用 https://dev59.com/enE85IYBdhLWcg3wXCS1#4910393
pip
程序,因此您需要访问专门针对更新版本的那个。 - wnnmawpip install --upgrade pip
命令时,输出为Requirement already up-to-date: pip in /usr/lib/python2.6/site-packages Cleaning up...
。 - Ethan