Import unresolved ( not recognized ) in PyDev

坚强是说给别人听的谎言 提交于 2020-03-25 21:48:46

问题


I am mostly a Java developer learning Python these days.
I have PyDev in Eclipse and I've properly configured, I believe.
Why? Because I am able to run Python programs in my Eclipse.

The problem is that it does not recognize this import of cx_Oracle
(even though it runs this program successfully).
The way I understand it, this cx_Oracle module is "the Python driver"
(in Java terms so to speak) to the Oracle RDBMS.

Why is that? Is there a way I can make this warning go away?

I am using these days the Anaconda distribution on Windows 10
(but I had the same issue with the official CPython distribution
so I don't think it's related to that).

This is what I have:

C:\>python
Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>> cx_Oracle.__file__
'C:\\Programs\\Anaconda3\\lib\\site-packages\\cx_Oracle.cp36-win_amd64.pyd'
>>>


回答1:


Humm, it seems that PyDev isn't recognizing the file C:\\Programs\\Anaconda3\\lib\\site-packages\\cx_Oracle.cp36-win_amd64.pyd as the cx_Oracle module (Python 3 has a new naming convention for compiled modules which PyDev isn't recognizing that well right now).

This is a bug in PyDev (I'll take a look at that). In the meanwhile, adding cx_Oracle to the list of forced builtins should do the trick. See: http://www.pydev.org/manual_101_interpreter.html#PyDevInterpreterConfiguration-ForcedBuiltins for more details on how to actually set that.



来源:https://stackoverflow.com/questions/48341305/import-unresolved-not-recognized-in-pydev

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!