英文:
Missing numpy while running other external python script
问题
我正在尝试从Python脚本中运行一个Python脚本。
我尝试以以下方式运行它:
os.system("python /opt/mycroft/skills/useridentification-skill/speakerIdentificationProgram/scoring.py")
然后我尝试像这样导入文件:
import sys
sys.path.append("/opt/mycroft/skills/useridentification-skill/speakerIdentificationProgram")
from scoring import get_id_result
它们都返回了这个错误:
File "/opt/mycroft/skills/useridentification-skill/__init__.py", line 9, in <module>
from scoring import get_id_result
File "/opt/mycroft/skills/useridentification-skill/speakerIdentificationProgram/scoring.py", line 2, in <module>
import numpy
ImportError: No module named 'numpy'
英文:
I am trying to run a python script from python script.
I tried to run it like this:
os.system("python /opt/mycroft/skills/useridentification-skill/speakerIdentificationProgram/scoring.py")
Then I tried to import the file like this:
import sys
sys.path.append("/opt/mycroft/skills/useridentification-skill/speakerIdentificationProgram")
from scoring import get_id_result
they both returned this error:
File "/opt/mycroft/skills/useridentification-skill/__init__.py", line 9, in <module>
from scoring import get_id_result
File "/opt/mycroft/skills/useridentification-skill/speakerIdentificationProgram/scoring.py", line 2, in <module>
import numpy
ImportError: No module named 'numpy'
答案1
得分: 2
只需在您的终端中尝试执行pip install numpy
。这将解决错误。
英文:
just try pip install numpy
in your terminal. this will remove error
答案2
得分: 1
我认为您在scoring.py中正在使用numpy模块,但您尚未在您的虚拟环境中安装numpy。在激活虚拟环境后使用 "pip install numpy"。
英文:
I think you are using numpy module in scoring.py but you have not installed numpy in your virtual environment.
Use "pip install numpy" after activating your virtualenv.
答案3
得分: 0
我假设您已按照以下方式添加技能,如果是这样的话,它应该会安装NumPy,如果技能确实需要它。
https://mycroft-ai.gitbook.io/docs/mycroft-technologies/mycroft-core/msm
参考 - https://github.com/MycroftAI/documentation/issues/143
否则,您应该使用:
mycroft-pip install numpy
然后您应该使用source
来激活Mycroft虚拟环境,然后使用Python命令来运行您的脚本。
英文:
I assume you followed this to add skills, if so it should install numpy if the skill actually required it
https://mycroft-ai.gitbook.io/docs/mycroft-technologies/mycroft-core/msm
Ref - https://github.com/MycroftAI/documentation/issues/143
Otherwise, you should be using
mycroft-pip install numpy
And you should be source
to activate the mycroft venv, and then use the Python command to run your script
答案4
得分: -2
使用Panda库进行数据操作和文件访问。
https://www.learnpython.org/en/Pandas_Basics
然后
npm install numpy
英文:
Use Panda libraries for data manipulation and file access.
https://www.learnpython.org/en/Pandas_Basics
then
npm install numpy
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论