简体   繁体   中英

How to locate a python package

I want to manually uninstall a python package, so it would not be accessible using import . I cannot locate the package in my system. When I use this advice (run python -v ), I have next output:

# /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/declarative/clsregistry.pyc matches /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/declarative/clsregistry.py
import sqlalchemy.ext.declarative.clsregistry # precompiled from /usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/declarative/clsregistry.pyc
# myfile.pyc matches myfile.py
import myfile # precompiled from myfile.pyc

myfile is a part of the package I want to uninstall.

How can I locate it?

To print a module's location:

import myfile
myfile.__file__

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