简体   繁体   English

安装pyodbc的Python Spyder 2.2.5错误

[英]Python Spyder 2.2.5 error installing pyodbc

When I type import pyodbc in my Spyder screen i get below error. 当我在Spyder屏幕上输入import pyodbc ,出现以下错误。 Any suggestions? 有什么建议么? How to install package pyodbc for Spyder 如何为Spyder安装软件包pyodbc

>>> runfile('C:/Users/myname/Documents/Python Scripts/co2nm.py', wdir=r'C:/Users/myname/Documents/Python Scripts')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\myname\AppData\Local\Continuum\Anaconda\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 540, in runfile
    execfile(filename, namespace)
  File "C:/Users/myname/Documents/Python Scripts/co2nm.py", line 7, in <module>
    import pyodbc 
ImportError: No module named pyodbc

I was able to use other packages though such as 我可以使用其他软件包,例如

import networkx as nx 
import os.path as path 
import datetime as dt

( Spyder dev here ) Spyder is not able to install packages by itself but it can use any package installed on the same Python version it is running on. 此处Spyder dev )Spyder本身无法安装软件包,但可以使用与运行其相同的Python版本安装的任何软件包。

I sincerely recommend you to use the Anaconda Python Distribution because it not only comes with Spyder and all its dependencies but you can also install pyodbc quite easily with it, by running this command on a terminal: 我真诚地建议您使用Anaconda Python发行版,因为它不仅包含Spyder及其所有依赖项,而且还可以通过在终端上运行以下命令来轻松安装pyodbc

conda install pyodbc

As the error message states, you don't have pyodbc installed, which is required for whatever you're trying to do. 如错误消息所述,您没有安装pyodbc,这是您尝试执行的所有操作所必需的。 I would suggest you install it, from you path I assume you're on windows. 我建议您安装它,从您假设我在Windows上开始。 There are pretty great windows instructions for installation of pyodbc here: 这里有很多很棒的Windows说明,用于安装pyodbc:

http://www.sperris.com/todays_goal/2008/10/installing-pyodbc-on-windows.html http://www.sperris.com/todays_goal/2008/10/installing-pyodbc-on-windows.html

Let me know if you have any questions. 如果您有任何疑问,请告诉我。

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

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