我使用 brew install jupyter
来安装的 jupyter 。 但是当我想要倒入 sklear 的包的时候总是告诉我找不到包。但是在本地的 python 环境中这个包已经安装。
通过在 jupyter 包中执行
import sys
print(sys.path)
发现
['/Users/mac/Desktop/jupyter', '', '/usr/local/Cellar/ipython/7.2.0/libexec/lib/python3.7/site-packages',
'/usr/local/Cellar/ipython/7.2.0/libexec/vendor/lib/python3.7/site-packages',
'/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python37.zip',
'/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7',
'/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload',
'/usr/local/lib/python3.7/site-packages', '/usr/local/Cellar/ipython/7.2.0/libexec/lib/python3.7/site-
packages/IPython/extensions', '/Users/mac/.ipython']
jupyter 使用的python 是 3.7 而我本地的 python 是 3.6 .因此无法找的相关的包。于是通过 pip3.7 install ***
将相关的包安装上,问题解决。
网友评论