python - 安装后无法运行 jupyter-book 命令
问题描述
我正在尝试使用 Jupyter-book 从我的输出中创建自动 PDF,但是在使用“pip install -U jupyter-book”命令(成功运行)安装它之后,它在我尝试时无法识别 jupyter-book运行命令:
输入:
jupyter_book create Jupyter_Book_Name
输出:
SyntaxError: invalid syntax (Temp/ipykernel_16888/3781613275.py, line 1)
File "C:\Users\MAXIME~1.DUS\AppData\Local\Temp/ipykernel_16888/3781613275.py", line 1
jupyter_book create Jupyter_Book_Name
^
SyntaxError: invalid syntax
我已经尝试在 sys.path 中添加init jupyter_book 函数,但我得到相同的错误,并且任何命令都会出现错误。我在 Windows 10 上的 Visual Studio Code 中使用 Jupyter Notebook 在 Python 3.9.7 中工作。
在此先感谢您,任何帮助都会对我有所帮助。
解决方案
看起来您将 shell (bash / ...) 与 Python REPL 混淆了。
您正在 Python 解释器中运行 shell 命令,有点像您尝试通过python
在 Python 解释器中键入来启动 Python:
$ python # Here I'm in bash, I run Python
Python 3.9.7 (default, Sep 3 2021, 06:18:44)
>>> python # Here I'm in the Python interpreter
# typing python again...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'python' is not defined
# Yup, calling `python` here make no sense, Python looks for a variable
# named `python` not a program named `python`, and won't find it.
所以离开 Python 解释器,找到一个 shell(取决于你的操作系统),然后再次运行命令。
哦,虽然我在这里,但可能不是:
jupyter_book create Jupyter_Book_Name
但:
jupyter-book create Jupyter_Book_Name
推荐阅读
- c# - 何时触发 RowsAdded 事件?
- php - Laradock 迁移命令没有这样的文件或目录
- angular - for 循环中的代码在 ngOnInt() 中不起作用
- excel - 使用 VBA 数组函数对过滤数据进行数据损坏
- javascript - 在php中分配变量时如何获取js变量
- google-sheets - 什么时候 ArrayFormula 可以与花括号互换?
- ruby-on-rails - MVC模型之外的PORO需要用户IP地址
- java - ArrivalEvent.java:6:错误:类 Event 中的构造函数事件不能应用于给定类型;
- java - Java15 fx15,使用 jpackage、maven、shaded 非模块化 .jar 运行良好!但安装运行 pkg - 应用程序说旧 JRE,java mongo 驱动程序异常
- windows-runtime - .NET 5、WinUI 3 和 WinRT API 可用于桌面应用程序