python升级2.6.6-->2.7.3引起的pip和easy_install执行错误

来源:互联网 发布:apache服务器搭建 编辑:程序博客网 时间:2024/06/05 05:55

centOS6.8将python2.6.6升级成2.7.3後无法执行sudo easy_install pip 也无法安装django

报错如下:

# pipTraceback (most recent call last):  File "/usr/bin/pip", line 5, in <module>    from pkg_resources import load_entry_pointImportError: No module named pkg_resources

其实发生这个问题是因为:虽然你已经把Python升级到了2.7版本,但是pip仍然是原来的,版本,仍然在原来python的site-package里面

试了这个

因为之前的python版本为2.6.6的后来升级为2.7的,但是easy_install还是读取2.6.6的配置
所以要重新做个软连接

[root@localhost bin]# ln -s /usr/local/python2.7/bin/easy_install /usr/bin/easy_installln: 正在创建指向“/usr/local/python2.7/bin/easy_install”的符号链接“/usr/bin/easy_install”: 文件已存在[root@localhost bin]# rm -rf /usr/bin/easy_install[root@localhost bin]# ln -s /usr/local/python2.7/bin/easy_install /usr/bin/easy_install

但是没用

然后试这个

Install the distribute package as follows:

$ wget https://svn.apache.org/repos/asf/oodt/tools/oodtsite.publisher/trunk/distribute_setup.py$ python distribute_setup.py

有用

附上地址

0 0
原创粉丝点击