[英]I can't import a module I installed with Anaconda Prompt in my Atom text editor. Is Miniconda causing problems with pip?
I have Miniconda installed. 我安装了Miniconda。 I successfully installed matplotlib with Anaconda Prompt. 我已将Anponda Prompt成功安装了matplotlib。 My text editor Atom gives me a ModuleNotFoundError when I attempt to import matplotlib. 当我尝试导入matplotlib时,我的文本编辑器Atom给我一个ModuleNotFoundError。 Why isn't Atom able to find matplotlib after I installed it with Anaconda Prompt? 我在Anaconda Prompt中安装了matplotlib后,为什么Atom无法找到它呢? matplotlib is located in Miniconda3 > Lib > site-packages matplotlib位于Miniconda3>库> site-packages
My current understanding is that I need to globally install matplotlib in my Python directory in order for Atom to be able to find it, but when I try to pip inside Command Prompt, I get an error saying: "'pip' is not recognized as an internal or external command, operable program or batch file." 我目前的理解是,我需要在Python目录中全局安装matplotlib才能使Atom能够找到它,但是当我尝试在命令提示符下进行pip操作时,出现了一条错误消息:“'pip'不能识别为内部或外部命令,可操作程序或批处理文件。”
Am I having issues because python was installed as part of Miniconda? 我是否有问题,因为python是作为Miniconda的一部分安装的? Why can't I pip install with Command Prompt, and only with Anaconda prompt? 为什么我不能使用命令提示符仅通过Anaconda提示进行pip安装? Why can't Atom find my Anaconda Prompt-installed matplotlib? 为什么Atom找不到我的Anaconda Prompt安装的matplotlib?
I am new to programming and Python. 我是编程和Python的新手。 Your help would be very much appreciated. 您的帮助将不胜感激。 I am considering uninstalling Miniconda (though that does not appear to be straightforward) and then installing Python by itself and going from there, but I don't think I should need to do this. 我正在考虑卸载Miniconda(尽管这似乎并不简单),然后自己安装Python并从那里进行安装,但是我认为我不需要这样做。
If you loaded python using Anaconda you should use conda instead of pip. 如果使用Anaconda加载了python,则应使用conda而不是pip。 The commands are very similar. 命令非常相似。 I would not start over. 我不会重新开始。 You will need to use virtual environments and that's much easier to do with conda. 您将需要使用虚拟环境,而使用conda则要容易得多。 Some conda commands are listed here . 这里列出了一些conda命令。 To create vitual environments follow instructions here . 要创建虚拟环境,请按照此处的说明进行操作。
Go to the terminal window and type conda install numpy, for example, to install numpy. 转到终端窗口,然后键入conda install numpy,例如,安装numpy。 If you're not on a Mac use the PowerShell or equivalent to the terminal for mac to run Unix-like commands. 如果您不在Mac上,请使用PowerShell或等效于mac的终端来运行类似Unix的命令。 Use same window as you were using for pip. 使用与用于点子相同的窗口。
Conda is a package manager and you can read more about it here . Conda是软件包经理,您可以在这里阅读有关它的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.