安装雪花连接器-python时出错

时间:2020-11-04 10:39:24

标签: python numpy pip snowflake-cloud-data-platform

我需要安装python连接器以运行脚本以将数据加载到Snowflake。 当我运行命令“ pip install雪花连接器-python”时,出现很多错误 与C编译器和numpy有关。 Python版本为3.8,pip也已升级。 请帮助我解决软件包安装问题。

以下是命令提示符下的错误列表:

        **compiling C sources
        creating build\temp.win-amd64-3.9\Release\numpy\random
        creating build\temp.win-amd64-3.9\Release\numpy\random\mtrand
        C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNPY_NEEDS_MIN
GW_TIME_WORKAROUND -Inumpy\core\include -Ibuild\src.win-amd64-3.9\numpy\core\include/numpy -Inumpy\core\src\common -Inum
py\core\src -Inumpy\core -Inumpy\core\src\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\np
ysort -Ic:\program files\python39\include -Ic:\program files\python39\include -Ibuild\src.win-amd64-3.9\numpy\core\src\c
ommon -Ibuild\src.win-amd64-3.9\numpy\core\src\npymath -Ibuild\src.win-amd64-3.9\numpy\core\src\common -Ibuild\src.win-a
md64-3.9\numpy\core\src\npymath -IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.270
23\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\i
nclude\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program Files (x86)\Win
dows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt /Tcnumpy\
random\mtrand\mtrand.c /Fobuild\temp.win-amd64-3.9\Release\numpy\random\mtrand\mtrand.obj
        mtrand.c
        numpy\random\mtrand\mtrand.c(35419): warning C4244: '=': conversion from 'npy_intp' to 'long', possible loss of
data
        numpy\random\mtrand\mtrand.c(35429): warning C4244: 'function': conversion from 'npy_intp' to 'long', possible l
oss of data
        numpy\random\mtrand\mtrand.c(35496): warning C4244: '=': conversion from 'npy_intp' to 'long', possible loss of
data
        numpy\random\mtrand\mtrand.c(36796): warning C4244: 'function': conversion from 'npy_intp' to 'unsigned long', p
ossible loss of data
        numpy\random\mtrand\mtrand.c(36980): warning C4244: 'function': conversion from 'npy_intp' to 'unsigned long', p
ossible loss of data
        numpy\random\mtrand\mtrand.c(37143): warning C4244: 'function': conversion from 'npy_intp' to 'unsigned long', p
ossible loss of data
        numpy\random\mtrand\mtrand.c(40343): warning C4146: unary minus operator applied to unsigned type, result still
unsigned
        numpy\random\mtrand\mtrand.c(40400): error C2039: 'tp_print': is not a member of '_typeobject'
        c:\program files\python39\include\cpython/object.h(193): note: see declaration of '_typeobject'
        numpy\random\mtrand\mtrand.c(42673): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3
        c:\program files\python39\include\cpython/unicodeobject.h(446): note: see declaration of '_PyUnicode_get_wstr_le
ngth'
        numpy\random\mtrand\mtrand.c(42689): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3
        c:\program files\python39\include\cpython/unicodeobject.h(446): note: see declaration of '_PyUnicode_get_wstr_le
ngth'
        error: Command "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\Hos
tX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1
 -DNPY_NEEDS_MINGW_TIME_WORKAROUND -Inumpy\core\include -Ibuild\src.win-amd64-3.9\numpy\core\include/numpy -Inumpy\core\
src\common -Inumpy\core\src -Inumpy\core -Inumpy\core\src\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -In
umpy\core\src\npysort -Ic:\program files\python39\include -Ic:\program files\python39\include -Ibuild\src.win-amd64-3.9\
numpy\core\src\common -Ibuild\src.win-amd64-3.9\numpy\core\src\npymath -Ibuild\src.win-amd64-3.9\numpy\core\src\common -
Ibuild\src.win-amd64-3.9\numpy\core\src\npymath -IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tool
s\MSVC\14.16.27023\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\W
indows Kits\10\include\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program
 Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cp
pwinrt /Tcnumpy\random\mtrand\mtrand.c /Fobuild\temp.win-amd64-3.9\Release\numpy\random\mtrand\mtrand.obj" failed with e
xit status 2
        ----------------------------------------
    ERROR: Command errored out with exit status 1: 'c:\program files\python39\python.exe' -u -c 'import sys, setuptools,
 tokenize; sys.argv[0] = '"'"'C:\\Users\\alarmdsys\\AppData\\Local\\Temp\\2\\pip-install-uvtm9ird\\numpy\\setup.py'"'"';
 __file__='"'"'C:\\Users\\alarmdsys\\AppData\\Local\\Temp\\2\\pip-install-uvtm9ird\\numpy\\setup.py'"'"';f=getattr(token
ize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __
file__, '"'"'exec'"'"'))' install --record 'C:\Users\alarmdsys\AppData\Local\Temp\2\pip-record-_15ijsu3\install-record.t
xt' --single-version-externally-managed --prefix 'C:\Users\alarmdsys\AppData\Local\Temp\2\pip-build-env-xh61rxin\overlay
' --compile --install-headers 'C:\Users\alarmdsys\AppData\Local\Temp\2\pip-build-env-xh61rxin\overlay\Include\numpy' Che
ck the logs for full command output.
    ----------------------------------------
  ERROR: Command errored out with exit status 1: 'c:\program files\python39\python.exe' 'c:\program files\python39\lib\s
ite-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\alarmdsys\AppData\Local\Temp\2\pip-build-env-x
h61rxin\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cython
 >= 0.29' 'numpy==1.14.5; python_version<'"'"'3.7'"'"'' 'numpy==1.16.0; python_version>='"'"'3.7'"'"'' setuptools setupt
ools_scm wheel Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files\python39\python.exe' 'c:\program files\python39\lib\sit
e-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\alarmdsys\AppData\Local\Temp\2\pip-build-env-a5q
k21fh\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptoo
ls>=40.6.0' wheel cython 'pyarrow>=0.17.0,<0.18.0' Check the logs for full command output.**

1 个答案:

答案 0 :(得分:2)

您似乎正在使用python 3.9。对于此设置,可以从您的错误消息中看到:

ERROR: Command errored out with exit status 1: 'c:\program files\python39\python.exe'

并且在安装numpy时失败,这可能很难从源代码编译,并且尚未针对python 3.9正式发布。

Python版本是3.8

至少您的设置使用的是3.9。版。在pypi上,snowflake-connector-python的所有文件仅使用python 3.7,但是您仍然可以尝试通过以下命令使用python 3.8从源代码进行安装:

c:\program files\python38\python.exe -m pip install snowflake-connector-python

(用您的python 3.8可执行文件的路径替换c:\program files\python38\python.exe