[英]Anaconda software can't find packages installed with pip on Windows
On Windows, open up Anaconda Prompt and type in the following:在 Windows 上,打开 Anaconda Prompt 并输入以下内容:
pip install json2xml
No complaints from pip
for doing this (replace json2xml
with your favorite package, I guess). pip
没有抱怨这样做(我猜用你最喜欢的包替换json2xml
)。 Then, open up Jupyter QTConsole, and try:然后,打开 Jupyter QTConsole,并尝试:
import json2xml
The result is an ImportError: No module named 'json2xml'
.结果是
ImportError: No module named 'json2xml'
。 The package installed (after checking pip list
), but nothing recognizes it.安装的包(在检查
pip list
),但没有识别它。 There is no system pip
(this is Windows, after all);没有系统
pip
(毕竟这是Windows); only Anaconda's pip
is being used.仅使用 Anaconda 的
pip
。
What's going on?这是怎么回事?
I hope this will help, it worked for me.我希望这会有所帮助,它对我有用。
When you use pip to install a package, by default it will go to your python site-packages.当您使用 pip 安装包时,默认情况下它会转到您的 python 站点包。 ie
IE
C:\\Users\\YOUR-USER-NAME\\AppData\\Local\\Programs\\Python\\Python37-32\\Lib\\site-packages
C:\\Users\\YOUR-USER-NAME\\AppData\\Local\\Programs\\Python\\Python37-32\\Lib\\site-packages
From here, you can copy the downloaded packages, then navigate and paste them into your Anaconda site-packages directory.从这里,您可以复制下载的包,然后导航并将它们粘贴到您的 Anaconda 站点包目录中。 ie
IE
C:\\Anaconda\\Lib\\site-packages
C:\\Anaconda\\Lib\\site-packages
That should solve the issue.那应该可以解决问题。
From How do I find the location of my Python site-packages directory?从如何找到我的 Python 站点包目录的位置? , you can enter
,你可以输入
python -m site
to print your python package location(s).打印您的python 包位置。 In my case, I have Anaconda for Windows and do not have a directory C:\\Users\\YOUR-USER-NAME\\AppData\\Local\\Programs\\Python\\Python37-32\\Lib\\site-packages but did find my package installed with pip was in C:\\Users\\YOUR-USER-NAME\\AppData\\Local\\Continuum\\anaconda3\\Lib\\site-packages\\ .
就我而言,我有 Windows 版 Anaconda 并且没有目录 C:\\Users\\YOUR-USER-NAME\\AppData\\Local\\Programs\\Python\\Python37-32\\Lib\\site-packages 但确实发现我的包安装了pip 在 C:\\Users\\YOUR-USER-NAME\\AppData\\Local\\Continuum\\anaconda3\\Lib\\site-packages\\ 中。 This may be due to adding Anaconda to PATH.
这可能是由于将 Anaconda 添加到 PATH。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.