简体   繁体   English

numpy 在 Jupyter Notebook 中运行良好,但在命令行中运行良好

[英]numpy works well in Jupyter Notebook, but not in command line

I am trying to schedule my py file in command line, it has been tested in jupyter notebook, and the ipynb file works well.我正在尝试在命令行中安排我的 py 文件,它已经在 jupyter notebook 中进行了测试,并且 ipynb 文件运行良好。 But when the py file runs in command line, it shows the problem:但是当py文件在命令行中运行时,就出现了问题:

Traceback (most recent call last): File "test_np.py", line 9, in <module> import numpy as np File "C:\Users\xxx\Anaconda3\lib\site-packages\numpy\__init__.py", line 140, in <module> from. import _distributor_init File "C:\Users\xxx\Anaconda3\lib\site-packages\numpy\_distributor_init.py", line 34, in <module> from. import _mklinit ImportError: DLL load failed: The specified module could not be found.

I have investigated the problem, and found one of the similar problem from link , but my Anaconda3 has been installed under Users\xxx\Anaconda3.我调查了这个问题,从链接中发现了一个类似的问题,但是我的 Anaconda3 已经安装在 Users\xxx\Anaconda3 下。 I am wondering:我想知道:
1. Whether the path variables is the reason of the problem? 1.路径变量是否是问题的原因?
2. If it is, should the Anaconda3 been reinstalled under ProgramData? 2.如果是,Anaconda3是否应该重新安装在ProgramData下?
3. If the path variables isn't the reason, what is the possible reason? 3. 如果路径变量不是原因,可能的原因是什么?
Thanks.谢谢。

It seems this problem caused by the path variables.看来这个问题是由路径变量引起的。 It has been soved by:它已被解决:
adding 5 variables as below to PATH variables:将以下 5 个变量添加到 PATH 变量中:
\anaconda3 \蟒蛇3
\anaconda3\Library\mingw-64t \anaconda3\图书馆\mingw-64t
\anaconda3\Library\usr\bin \anaconda3\库\usr\bin
\anaconda3\Library\bin \anaconda3\库\bin
\anaconda3\Scripts \anaconda3\脚本

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

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