简体   繁体   English

无法使用Anaconda在python中导入psycopg2

[英]Unable to import psycopg2 in python using anaconda

I have installed Anaconda 2.7 on my desktop and want to connect it to Postgresql server. 我已经在桌面上安装了Anaconda 2.7,并希望将其连接到Postgresql服务器。

I also installed psycopg2 through command prompt and it was successful. 我还通过命令提示符安装了psycopg2,它成功。 But when I import it using Jupyter notebook it shows me the following error. 但是,当我使用Jupyter Notebook导入它时,它显示了以下错误。

ImportError Traceback (most recent call last) in () ----> 1 import psycopg2 ()中的ImportError Traceback(最近一次通话最后一次)----> 1 import psycopg2

C:\\Users\\amitdarak\\AppData\\Local\\Continuum\\anaconda2\\lib\\site-packages\\psycopg2-2.7.3.2-py2.7-win-amd64.egg\\psycopg2__init__.py in () 48 # Import the DBAPI-2.0 stuff into top-level module. C:\\ Users \\ amitdarak \\ AppData \\ Local \\ Continuum \\ anaconda2 \\ lib \\ site-packages \\ psycopg2-2.7.3.2-py2.7-win-amd64.egg \\ psycopg2__init __。py in()48#导入DBAPI-2.0东西放入顶层模块。 49 ---> 50 from psycopg2._psycopg import ( # noqa 51 BINARY, NUMBER, STRING, DATETIME, ROWID, 52 从psycopg2._psycopg导入49 ---> 50(#noqa 51 BINARY,NUMBER,STRING,DATETIME,ROWID,52

ImportError: DLL load failed: The specified module could not be found ImportError:DLL加载失败:找不到指定的模块

conda install -c anaconda postgresql worked fine for me on Windows 10. 在Windows 10上, conda install -c anaconda postgresql对我来说效果很好。

I know postgresql isn't the same module as psycopg2 , but the easy installation of postgresql would trump any advantages psycopg2 might have for me. 我知道postgresqlpsycopg2是不同的模块,但是易于安装的postgresql将胜过psycopg2对我而言可能具有的任何优势。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM