Jupyter上的雪花连接器

2024-04-19 01:58:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用以下代码连接到Jupyter笔记本上的雪花:

import snowflake.connector 

使用Python Idle可以很好地工作,但在Jupyter上会出现以下错误:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-4-d11bd0d24b4f> in <module>
----> 1 import snowflake.connector

ModuleNotFoundError: No module named 'snowflake'

我在网上找到了一些解决方案,声明使用以下命令在Jupyter中修复此问题:

!pip install snowflake-connector-python
import snowflake.connector

然而,这会遇到:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001E5B5757A88>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/snowflake-connector-python/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001E5B5757288>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/snowflake-connector-python/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001E5B59DDB88>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/snowflake-connector-python/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001E5B59DD0C8>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/snowflake-connector-python/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001E5B59DD2C8>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/snowflake-connector-python/
ERROR: Could not find a version that satisfies the requirement snowflake-connector-python (from versions: none)
ERROR: No matching distribution found for snowflake-connector-python
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-5-f59c5a948575> in <module>
      1 get_ipython().system('pip install snowflake-connector-python')
----> 2 import snowflake.connector

ModuleNotFoundError: No module named 'snowflake'

如果有什么原因我不能安装这个库,请告诉我,如果有任何关于为什么我可以在pythonidle而不是Jupyter笔记本上使用它的见解,我将不胜感激。Python版本3.7.9


Tags: pipnonereadconnectorstatusconnectconnectionredirect