简体   繁体   English

安装Anaconda后难以安装python模块

[英]Difficulty installing python modules after installing anaconda

I just started working with anaconda. 我刚开始与anaconda合作。 Earlier I was working with Python 2.7 on my system. 之前,我在系统上使用Python 2.7。 I was writing a script for devices connected to my laptop via usb. 我正在为通过USB连接到笔记本电脑的设备编写脚本。 For this, I needed the usb module/package. 为此,我需要usb模块/软件包。 I initially tried doing in Python 27. I installed using: 我最初尝试使用Python 27进行安装。

easy_install libusb1

The output with this is ( screenshot is also there) : 的输出是(也有屏幕截图):

Searching for libusb1
Best match: libusb1 1.4.0
Processing libusb1-1.4.0-py3.4.egg
libusb1 1.4.0 is already the active version in easy-install.pth

Using c:\users\eku\anaconda3\lib\site-packages\libusb1-1.4.0-py3.4.egg
Processing dependencies for libusb1
Finished processing dependencies for libusb1

C:\\users\\eku\\anaconda3\\ : this is the path according to my system whose name is eku. C:\\ users \\ eku \\ anaconda3 \\:这是根据我的系统命名为eku的路径。

Installing with pip shows an error unknown command libusb1 使用pip安装会显示error unknown command libusb1

Because I have installed the package before, the screenshot shows the correct result that the package is already installed. 因为我之前已经安装过该软件包,所以屏幕截图显示了该软件包已经安装的正确结果。 But the locatio is where my anaconda's site-packages are there. 但是这个位置是我的Anaconda的站点软件包所在的位置。

在此处输入图片说明

Why is this occurring and how should I correct this. 为什么会发生这种情况,我应该如何纠正呢。 I want to keep both anaconda and the other 2.7 version separate. 我想将anaconda和其他2.7版本分开。 (If this has something to do with path variable, then yes I am confused about the same). (如果这与路径变量有关,那么是的,我对此感到困惑)。

As can be seen from the above output the libusb gets installed in in anaconda, I tried running the same code in Spyder (in anaconda). 从上面的输出可以看出,libusb已安装在anaconda中,我尝试在Spyder(anaconda中)中运行相同的代码。 When I write, 我写的时候

import usb1

I get the error: 我收到错误:

ImportError: No module named 'usb1'

Why is this happening? 为什么会这样呢?

My spyder got installed with anaconda itself. 我的spyder本身安装了anaconda。 I simply click on its icon and the workspace launches. 我只需单击其图标即可启动工作区。 Nothing more I had to do, it started working and even my other files are working fine. 无需执行其他操作,它开始工作,甚至我的其他文件也可以正常工作。

Thanks! 谢谢!

I know it's a bit after the fact, but I had the same issue. 我知道这是事实,但我有同样的问题。 I ended up searching my registry (I used a program called RegistryFinder, there are likely others) and finding that there was a registry value pointing to the Anaconda install directory. 我最终搜索了注册表(我使用了一个名为RegistryFinder的程序,可能还有其他程序),并发现存在指向Anaconda安装目录的注册表值。 I deleted it and I was able to install things to my normal Python directory. 我删除了它,然后将其安装到普通的Python目录中。 I had previously uninstalled Anaconda and wasn't worried about having references to it, so you may want to save off those values. 我以前已经卸载了Anaconda,并且不担心会引用它,因此您可能希望保存这些值。

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

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