我曾经使用Anaconda进行数据探索。我创建了一个虚拟环境。我可以从中启动jupyter notebook或为其创建ipykernel。例如:
1.从虚拟环境启动jupyter Notebook:
(base) C:\Users\me>activate my-env
(my-env) C:\Users\me>jupyter notebook
并且jupyter笔记本针对虚拟环境启动。
2.创建ipykernel:
(base) C:\Users\me>activate my-env
(my-env) C:\Users\me>conda install ipykernel
(my-env) C:\Users\me>python -m ipykernel install --user --name my-env --display-name "Python (my-env)"
(my-env) C:\Users\me>conda deactivate
(base) C:\Users\me>jupyter notebook
然后我可以直接在笔记本中为my-env选择内核。
但是最近我切换到了miniconda。我做与上述2种方法相同的操作。但是失败了。
对于方法1,我收到此错误:
'jupyter' is not recognized as an internal or external command, operable program or batch file.
对于方法2,我可以在jupyter笔记本中选择内核my-env。但是当我导入numpy时出现了此错误:
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: The specified module could not be found.
我不认为问题出在numpy上,因为如果我以这种方式导入它,它将起作用。
(my-env) C:\Users\me>python
Python 3.7.2 (default, Jan 2 2019, 17:07:39) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>>
那么,我该如何解决这个问题?