elasticsearch 在Jupyter Notebook中运行Linux命令

kse8i1jr  于 2023-05-22  发布在  ElasticSearch
关注(0)|答案(1)|浏览(250)

我有一个google colab文件,我想在Visual Studio Code中运行。正常细胞运行正常,但我有以下细胞:

# 1. Downloads, extracts, and sets the permissions for the Elasticsearch installation image:
%%bash

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.2-linux-x86_64.tar.gz -q
tar -xzf elasticsearch-7.9.2-linux-x86_64.tar.gz
chown -R daemon:daemon elasticsearch-7.9.2

问题是我在wget上获取SyntaxError: invalid syntax
我已经尝试了多种解决方案从stackoverflow
1.使用我在Google Colab中使用的通用%%bash
1.使用%%shell
1.使用1的较长版本%%script bash
1.使用%%script bash
1.使用快捷方式%%!
我使用了像thisthis这样的源代码。This是我使用的教程

vawmfj5a

vawmfj5a1#

好吧我自己找到解决办法了

# 1. Downloads, extracts, and sets the permissions for the Elasticsearch installation image:
%%!

!wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.2-linux-x86_64.tar.gz -q
!tar -xzf elasticsearch-7.9.2-linux-x86_64.tar.gz
!chown -R daemon:daemon elasticsearch-7.9.2

这是正确的语法

相关问题