简体   繁体   English

Python 2.7 错误导入ROOT

[英]Python 2.7 error import ROOT

I installed root.exe in the folder C:\\root_v5.34.36, folder C:\\root_v5.34.36\\bin which contains ROOT.py我在文件夹 C:\\root_v5.34.36,文件夹 C:\\root_v5.34.36\\bin 中安装了 root.exe,其中包含 ROOT.py

When I started a Jupiter Notebook (anaconda), I write :当我启动 Jupiter Notebook (anaconda) 时,我写道:

import sys
sys.path.append("C:\root_v5.34.36\bin")

Then然后

import ROOT

And it displays :它显示:

ImportError                               Traceback (most recent call last)
<ipython-input-2-b332e25ada1f> in <module>()
----> 1 import ROOT

ImportError: No module named ROOT

What's wrong?怎么了?

尝试将根 bin 路径更改为sys.path.append("C:\\\\root_v5.34.36\\\\bin")

You need to run the file thisroot.bat usually found in the config folder of the ROOT directory before starting the notebook application.在启动笔记本应用程序之前,您需要运行通常在 ROOT 目录的config文件夹中找到的文件thisroot.bat

This should be done by opening a powershell and typing:这应该通过打开一个 powershell 并输入:

cd  C:\root_v5.34.36
.\config\thisroot.bat
C:\WhereverTheJupyterNotebookApplicationIs\JupyterNotebook.exe

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

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