Sympy在终端工作,但在Jupiter Notebook或Jupyterlab中工作,有什么建议吗?
硬件/软件:
MacBook Pro 16英寸,2021 -M1 Max(Macos Monterey版本12.4)和Python 3.9.13。
已经尝试过:
pip install sympy
pip install -u sympy
conda安装sympy
conda install -c conda-forge sympy
在终端中工作正常:
>>> from sympy import *
>>>
但是在jupyter-lab和jupiter笔记本中:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 from sympy import *
ModuleNotFoundError: No module named 'sympy
Hardware/Software:
MacBook Pro 16-inch, 2021 - M1 max (macOS Monterey Version 12.4) and Python 3.9.13.
Have tried:
pip install sympy
pip install -U sympy
conda install sympy
conda install -c conda-forge sympy
In terminal it works fine:
>>> from sympy import *
>>>
But in both jupyter-lab and Jupiter notebook:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 from sympy import *
ModuleNotFoundError: No module named 'sympy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@creanion提出的调试步骤
a:
在终端:
创建@hrokr建议的虚拟环境
安装
安装
ipykernel
不确定我是否应该在此步骤之前激活
env
,或者这里的所有内容都是必要的,但是以下是全局安装的activate env,打开jupyter-lab,然后选择新创建的
pyc39
以验证Debugging step as proposed by @creanion
a:
In terminal:
Creating virtual environment as suggested by @hrokr
Install
Install
ipykernel
Was not sure if I should have activated
env
in prior to this step, and or everything here was necessary, however the following was globally installedActivate env, open jupyter-lab and choose the newly created
pyc39
to verify