已安装 databricks-cli,模块不可见
databricks-cli installed, modules not visible
我安装了 Databricks CLI,但我无法像这样使用该库:
在powershell中,我将工作目录设置为:C:\Users\DNaught1\AppData\Local\Programs\Python\Python39\Scripts
我知道模块在那里:
Mode LastWriteTime Length Name
-a---- 13/10/2020 1:46 PM 74752 databricks.exe**
然后我尝试查看版本,但没有成功,如下所示:
PS C:\Users\DNaught1\AppData\Local\Programs\Python\Python39\Scripts> databricks --version
databricks : The term 'databricks' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is
correct and try again. At line:1 char:1
- databricks --version
-
+ CategoryInfo : ObjectNotFound: (databricks:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Suggestion [3,General]: The command databricks was not found, but does
exist in the current location. Windows PowerShell does not load
commands from the current location by default. If you trust this
command, instead type: ".\databricks". See "get-help
about_Command_Precedence" for more details.
我设法使用以下方法解决了这个问题:
1- 在 Python 中使用下面的命令安装 CLI 模块
package_names=['databricks-cli', 'requests'] #packages to install
pip.main(['install'] + package_names + ['--upgrade'])
2- 在 powershell cli 中:
将上下文更改为工作目录:
Set-Location -Path C:\Users\DNaught1\AppData\Local\Programs\Python\Python39\Scripts
3 - 配置数据块 cli:
.\databricks.exe configure--token
.\databricks configure --token
Host: https://xxx.azuredatabricks.net
Token: dapi2b2dxxxxxxxxxa02c9e6866d322 - Access token for Secrets
4 - Write-host databricks 访问的配置文件
Set-Content .databrickscfg "[DEFAULT]"
>> Add-Content .databrickscfg "host = https://xxx.azuredatabricks.net"
>> Add-Content .databrickscfg "token = dapi2b2dxxxxxxxxxa02c9e6866d322"
5 - 通过检查文件存储进行验证
.\dbfs ls
我安装了 Databricks CLI,但我无法像这样使用该库:
在powershell中,我将工作目录设置为:C:\Users\DNaught1\AppData\Local\Programs\Python\Python39\Scripts
我知道模块在那里:
Mode LastWriteTime Length Name
-a---- 13/10/2020 1:46 PM 74752 databricks.exe**
然后我尝试查看版本,但没有成功,如下所示:
PS C:\Users\DNaught1\AppData\Local\Programs\Python\Python39\Scripts> databricks --version
databricks : The term 'databricks' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1
- databricks --version
+ CategoryInfo : ObjectNotFound: (databricks:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Suggestion [3,General]: The command databricks was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\databricks". See "get-help about_Command_Precedence" for more details.
我设法使用以下方法解决了这个问题:
1- 在 Python 中使用下面的命令安装 CLI 模块
package_names=['databricks-cli', 'requests'] #packages to install
pip.main(['install'] + package_names + ['--upgrade'])
2- 在 powershell cli 中: 将上下文更改为工作目录:
Set-Location -Path C:\Users\DNaught1\AppData\Local\Programs\Python\Python39\Scripts
3 - 配置数据块 cli:
.\databricks.exe configure--token
.\databricks configure --token
Host: https://xxx.azuredatabricks.net
Token: dapi2b2dxxxxxxxxxa02c9e6866d322 - Access token for Secrets
4 - Write-host databricks 访问的配置文件
Set-Content .databrickscfg "[DEFAULT]"
>> Add-Content .databrickscfg "host = https://xxx.azuredatabricks.net"
>> Add-Content .databrickscfg "token = dapi2b2dxxxxxxxxxa02c9e6866d322"
5 - 通过检查文件存储进行验证
.\dbfs ls