简体   繁体   English

如何从Anaconda而不是默认pip目录导入软件包

[英]How to import packages from Anaconda instead of default pip directory

在此处输入图片说明 When using iPython and Jupyter Notebook, the commands 使用iPython和Jupyter Notebook时,命令

import numpy as np
import pandas as pd

always try to import the packages from the default python directory: 始终尝试从默认的python目录导入软件包:

 C:/Users/sx449_000/AppData/Roaming/Python/Python36/site-packages

How can I change it to make it import from my anaconda site packages as below? 我如何更改它以使其从我的anaconda网站包中导入,如下所示?

 C:/programdata/miniconda3/lib/site-packages 

First, make sure you are using the right kernel in your ipython notebook, otherwise, you can change it from kernel >> change kernel 首先,请确保您在ipython笔记本中使用了正确的内核 ,否则,可以从内核>>更改内核中进行更改。

You can also try, 您也可以尝试

 import sys
 sys.path.append('C:/programdata/miniconda3/lib/packages/numpy')
 import numpy as np

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

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