解决 "python installation is corrupted"?

How to fix "python installation is corrupted"?

up vote
22
down vote

favorite

2

I was upgrading from 13.10 to 14.04 (dev for now, stable in a few hours) using do-release-upgrade and encountered the following problem:

Cannot upgrade 

Your python install is corrupted.Please fix the '/usr/bin/python' symlink.

I solved the problem after messing around a bit, so I'd like to share my solution here. Hope this could help someone.

add a comment | 

up vote
40
down vote

accepted

My problem turned out to be solely due to an altered /usr/bin/python symlink as suggested in the error message. I was using update-alternatives with /usr/bin/python so it was pointing to /etc/alternatives/python. Turned out that do-release-upgrade is really strict with this symlink and merely selecting python2.7 with update-alternatives isn't enough, so I ended up forcing it to its original state:

sudo ln -sf /usr/bin/python2.7/usr/bin/python

And that solved the problem.

If this doesn't work for you, then I guess you have a genuinely corrupted python install. I'd suggest

sudo apt-get install --reinstall python

answered Apr 17 '14 at 8:16

 | 
show 2 more comments

up vote
8
down vote

this one is correct:

sudo update-alternatives --remove-all python
sudo ln -sf /usr/bin/python2.7/usr/bin/python

add a comment | 

up vote
1
down vote

In Ubuntu 18.10 there is still the same issue.

The /usr/bin/python is linked to an older version. Even later than 2.7 are available but this super-smart process is asking (in 18.10!) for P 2.7. So I gave it and it was accepted.

This solved it for me:

1) delete /usr/bin/python doing sudo rm /usr/bin/python

2) Create a new link sudo ln -sf /usr/bin/python2.7 /usr/bin/python

In 18.10 I could NOT use sudo update-alternatives --remove-all python or sudo apt-get install --reinstall python .

Works for me. Hope it helps you, too.

 | 
show 1 more comment

Your Answer

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Post as a guest

Name

Email

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged upgrade python or ask your own question.

Measure

Measure

David_Li

我还没有学会写个人说明!

相关推荐

暂无评论