首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
推荐学习书目
›
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
V2EX
›
Python
怎么动态调用第三方库?
302790951
·
2014-11-25 19:20:10 +08:00
· 2452 次点击
这是一个创建于 3617 天前的主题,其中的信息可能已经有所发展或是发生改变。
from lib.aa.bb import cc
其中aa bb是动态的,貌似不能用变量存储 还有什么办法动态调用第三方库吗?
调用
方库
lib.aa.bb
5 条回复
•
2014-11-25 21:20:08 +08:00
1
11
2014-11-25 19:25:26 +08:00
1
http://stackoverflow.com/questions/301134/dynamic-module-import-in-python
2
302790951
OP
2014-11-25 20:35:46 +08:00
@
11
感谢
还有一个问题,python二级目录下的类怎么引用?
用
from test.lib.test import test
报错
ImportError: No module named lib.test
3
c
2014-11-25 20:37:31 +08:00
__init__.py?
4
302790951
OP
2014-11-25 21:19:43 +08:00
@
11
用imp 库解决了 感谢
5
302790951
OP
2014-11-25 21:20:08 +08:00
@
c
用imp 库解决了
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
实用小工具
·
5881 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 27ms ·
UTC 03:28
·
PVG 11:28
·
LAX 20:28
·
JFK 23:28
Developed with
CodeLauncher
♥ Do have faith in what you're doing.