简体   繁体   中英

My version of python have multiple versions of packages in 'site-packages', is it safe to delete some of them?

I have, in /usr/local/lib/python2.7/site-packages multiple versions of the same package.

Eg I have django-angular-0.7.13-py2.6.egg , django-angular-0.7.13-py2.6.egg-info , and django-angular-0.7.13-py2.7.egg .

Is it safe to delete the two files that are, ostensibly, the wrong version?

When I got into the python interpreter, import the package/module, it tells me it's run from <module 'django_angular' from '/usr/local/lib/python2.7/site-packages/django-angular-0.7.13-py2.6.egg/django_angular/__init__.py'> ...

I'm concern I'll irreparably damage my python packages, as is so easy when you mess with these things.

All I could find on the topic is this article, but that's windows specific, and doesn't address having multiple versions of the same thing.

You shouldn't go and delete the files manually, although it is probably safe. It is quite unlikely that your system depends on Django and Python always uses only one version of the installed packages anyway.

However, I would strongly recommend keeping your development environment separated from your system packages. If you haven't already, take a look at pip and virtualenv . Here is one tutorial for them.

With pip you can also uninstall your system libraries if you really want to do that. However, pip only sees one version at a time, so if you want to uninstall the above packages you have to run pip uninstall multiple times. But after all the versions are gone you can install the version you really want.

Also, a better option for displaying the installed versions is to use yolk . With that you don't have to browse the site-packages manually.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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