英文:
Running Linux Commands in Jupyter Notebook
问题
I have a google colab file that I want to run in Visual Studio Code. Normal cells are running ok but I have the following cell:
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
The problem is that I am getting SyntaxError: invalid syntax
on the wget
I have tried multiple solutions from stackoverflow
- Use the generic
%%bash
I use in Google Colab too. - Use
%%shell
- Use the longer version of 1,
%%script bash
- Use
%%script
bash - Use the shortcut
%%!
I used source like this, this. This is the tutorial I used
英文:
I have a google colab file that I want to run in Visual Studio Code. Normal cells are running ok but I have the following cell:
# 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
The problem is that I am getting SyntaxError: invalid syntax
on the wget
I have tried multiple solutions from stackoverflow
- Use the generic
%%bash
I use in Google Colab too. - Use
%%shell
- Use the longer version of 1,
%%script bash
- Use
%%script
bash - Use the shortcut
%%!
答案1
得分: 1
这是正确的语法。
英文:
Ok I found the solution by myself
# 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
This is the correct syntax
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论