在SQL Server 2017中启用Python
我已执行以下命令:在SQL Server 2017中启用Python,python,sql-server,sql-server-2017,Python,Sql Server,Sql Server 2017,我已执行以下命令: EXEC sp_configure 'external scripts enabled', 1 RECONFIGURE WITH OVERRIDE 从消息中可以看出,这一切都是成功的: Configuration option 'external scripts enabled' changed from 1 to 1. Run the RECONFIGURE statement to install. 但是,当执行以下脚本时,其显示错误: exec sp_exec
EXEC sp_configure 'external scripts enabled', 1
RECONFIGURE WITH OVERRIDE
从消息中可以看出,这一切都是成功的:
Configuration option 'external scripts enabled' changed from 1 to 1. Run the RECONFIGURE statement to install.
但是,当执行以下脚本时,其显示错误:
exec sp_execute_external_script
@language =N'Python',
@script=N'OutputDataSet = InputDataSet
print("Input data is {0}".format(InputDataSet))',
@input_data_1 = N'SELECT 1 as col'
错误:
Msg 39023, Level 16, State 1, Procedure sp_execute_external_script, Line 1 [Batch Start Line 7]
'sp_execute_external_script' is disabled on this instance of SQL Server. Use sp_configure 'external scripts enabled' to enable it.
执行时:exec sp_configure
其显示的“外部脚本已启用”运行值为0
当我通过运行更新查询更新“运行值”时:
update sys.configurations set value_in_use = 1
where name like 'external scripts enabled'
获取错误:
Ad hoc updates to system catalogs are not allowed.
以下是系统详细信息(来自SSMS帮助->关于):
SQL Server Management Studio 15.0.18118.0
Microsoft Analysis Services客户端工具15.0.1300.131
Microsoft数据访问组件(MDAC)10.0.17134.1
Microsoft MSXML 3.0 6.0
Microsoft Internet Explorer 9.11.17134.0
Microsoft.NET Framework 4.0.30319.42000
操作系统6.3.17134
Microsoft SQL Server 2017(RTM-CU14)(KB4484710)-14.0.3076.1(X64)
2019年3月12日19:29:19
版权所有(C)2017微软公司
Windows 10 Home 10.0(版本17134:)上的开发者版(64位)
另外,尝试从此处()安装SQL Server最新更新
Python安装失败
如何解决此问题并在SQL Server 2017上运行python?我是否需要安装任何SQL Server service pack?请建议。
谢谢。在SQL Server 2017上,运行
EXEC sp_配置“已启用外部脚本”后,1
使用OVERRIDE重新配置
,您需要重新启动实例
exec sp_execute_external_script
@language=N'Python'
, @script=N'
print("Hello World")'
go
exec sp_execute_external_script
@language=N'R'
, @script=N'print(R.version)'
go
这不是您的SQL Server版本,这是SSMS的版本;这是完全无关的。使用
PRINT@@VERSION代码>以获取您的SQL Server版本。使用SQL版本更新了我的问题。
exec sp_execute_external_script
@language=N'Python'
, @script=N'
print("Hello World")'
go
exec sp_execute_external_script
@language=N'R'
, @script=N'print(R.version)'
go