简体   繁体   English

如何在 jupyter 中运行“python -m”命令

[英]How do I run 'python -m' command in jupyter

Some imports eg spacy need me to run:一些进口,例如 spacy 需要我运行:

python -m spacy download de_core_news_sm

How do I manage to make this happen from within a cell in jupyter lab?我如何设法在 jupyter 实验室的一个单元内实现这一点?

Or can I simply put this in a requirement.txt file?或者我可以简单地把它放在一个requirement.txt文件中吗?

The goal is to make a notebook run without installing something extra, but the requirements file.目标是让笔记本运行而不需要安装额外的东西,而是安装需求文件。

You simply run these command in the cell by putting a "!"您只需在单元格中添加“!”即可运行这些命令before the line of code在代码行之前

ex.前任。

! python -m spacy download de_core_news_sm

this will work.这会奏效。

Happy Coding!快乐编码!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM