V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
302790951
V2EX  ›  Python

怎么动态调用第三方库?

  •  
  •   302790951 · Nov 25, 2014 · 3034 views
    This topic created in 4182 days ago, the information mentioned may be changed or developed.
    from lib.aa.bb import cc

    其中aa bb是动态的,貌似不能用变量存储 还有什么办法动态调用第三方库吗?
    5 replies    2014-11-25 21:20:08 +08:00
    302790951
        2
    302790951  
    OP
       Nov 25, 2014
    @11 感谢

    还有一个问题,python二级目录下的类怎么引用?

    from test.lib.test import test
    报错
    ImportError: No module named lib.test
    c
        3
    c  
       Nov 25, 2014
    302790951
        4
    302790951  
    OP
       Nov 25, 2014
    @11 用imp 库解决了 感谢
    302790951
        5
    302790951  
    OP
       Nov 25, 2014
    @c 用imp 库解决了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1179 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 23:21 · PVG 07:21 · LAX 16:21 · JFK 19:21
    ♥ Do have faith in what you're doing.