Python Unresolved import
来源:互联网 发布:阿里云部署java项目 编辑:程序博客网 时间:2024/06/04 18:31
from selenium import webdriver 产生 Unresolved import: webdriver的问题。
在网上查了一些资料,有人说是在包里面有和包名一样的py文件存在,try 后问题不能解决。
之后在 Stack Overflow 上发现了解决方案,
原文链接 http://stackoverflow.com/questions/2983088/unresolved-import-models/2983096
Even if Lib/site-packages is added to the PYTHONPATH, this problem may happen when using modules from egg packages installed using easy_install. The problem with those, and that might actually depend on the easy_install version, is that by default they don't get installed directly inside Lib/site-packages but rather under a folder containing the full package name and having the .egg suffix. For example: Lib/site-packages/django_celery-3.0.23-py2.7.egg
Each module coming from packages installed as above needs an individual entry in PYTHONPATH. If the packages are installed after PyDev has been installed on the system, the system PYTHONPATH needs to be updated in PyDev. That is done automatically by going to Window -> Preferences -> PyDev -> Select your intepreter -> in the python interpreters panel remove and re-add your current python interpreter (usually, this should be the python executable from the system). Then a PyDev restart (File -> Restart) should solve the "Unresolved import" errors.
作者的意思是问题是easy_install的问题,如果是在安装pydev之前安装的模块,应该不会有这个问题。如果是eclipse 安装了pydev之后用easy_insall安装的pydev,则需要重新配置一下pydev的interpreter 即可。
步骤:
1.删除原来的pydev的interpreter(windows->preference->pydev->interpreter)
2.把interpreter加进来,pydev会自动扫描python 下libs的所有模块,包括site-packages下的所有模块.
另:
pydev 官方解释:
http://pydev.org/manual_101_interpreter.html
- Python Unresolved import
- Selenium with Python: Unresolved Import Issues
- Unresolved import
- python pydev引用第三方库Unresolved import:
- pydev python eclipse PIL 提示Unresolved import: Image
- pydev python Ŀ "Unresolved import:"出现错误的解决方法
- Python导入第三方模块后eclipse提示unresolved import
- PyDev Unresolved Import Error
- unresolved import in eclipse pydev
- python import、from import
- 关于ecilipse中 Unresolved import: module问题
- Unresolved Import Issues with PyDev and Eclipse
- Aptana Studio3 解决unresolved import的问题
- Python import
- Python import
- Python import
- Python import
- python import
- 第十三周OJ平台(1)数组逆序输出
- Ajax 相前台打印
- 第十三周项目五:字符串操作2.1
- Android的Service中弹出窗口解决方法
- QThread使用
- Python Unresolved import
- 第13周项目1(4)-数组大折腾
- Linux的awk命令详解
- 第二篇.WDF驱动简介及几个驱动对象介绍
- 第十三周项目1--(3)数组中元素为3倍数的和下标为3倍数的数
- visual studio快捷键大全
- 项目jar包 与tomcat 自带jar 冲突
- EditText在XML布局中设置inputType后hint字体会改变
- 第13周项目2-成绩处理