从包中隐藏额外的导入

2024-09-30 18:15:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个包,可以输入很多噪音。我试着用__all__这样:

__all__ = ["WebdriverChauffeurMixin", "ChromeDriver", "FirefoxDriver"]

但这无济于事:

cchilders:~/projects/webdriver_chauffeur (master) 
$ pip uninstall webdriver-chauffeur
Can't uninstall 'webdriver-chauffeur'. No files were found to uninstall.

cchilders:~/projects/webdriver_chauffeur (master) 
$ pip uninstall webdriver_chauffeur
Can't uninstall 'webdriver-chauffeur'. No files were found to uninstall.

In [2]: from webdriver_chauffeur import 
BeautifulSoup            Keys                     os
By                       Select                   random
ChromeDriver             TimeoutException         subprocess
EC                       WebDriverWait            time
FirefoxDriver            WebdriverChauffeurMixin  webdriver

包在pypi上,但也在我的机器上~/projects/webdriver_chauffeur

包位于https://github.com/codyc4321/webdriver_chauffeur

如何隐藏这些不必要的导入?谢谢


Tags: pipnomasterfilesallcanchromedriverprojects