【问题标题】:Unable to install modules for anaconda无法为 anaconda 安装模块
【发布时间】:2015-09-04 03:02:00
【问题描述】:
abhigenie92@ubuntu:~/Desktop/pygame-1.9.1release$ which python
/home/abhigenie92/anaconda/bin/python
abhigenie92@ubuntu:~/Desktop/pygame-1.9.1release$ sudo apt-get install python-pygame
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-pygame is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 224 not upgraded.
abhigenie92@ubuntu:~/Desktop/pygame-1.9.1release$ python 
Python 2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 17:02:03) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import pygame
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pygame

上面发生了什么?它似乎没有为 anaconda 安装。但它从路径指向右侧。

【问题讨论】:

  • 您是否尝试过从 anacondas 安装的 pip 安装?
  • @Simon 我试过sudo pip install hg+http://bitbucket.org/pygame/pygame 它显示Successfully installed pygame。但仍然 anaconda python 没有显示这样的模块。
  • 我不确定 anaconda 是否设置了任何类型的 virtualenv - 我认为确实如此。我不在 linux 上使用 anaconda,但在 windows 上使用 anacondas pip 安装我会这样做:/home/abhigenie92/anaconda/bin/pip.exe install pygame。 Linux 带有自己的 python 安装,安装 anaconda 将安装第二个,因此您需要导航到 anacondas pip 所在的位置并使用它安装模块。使用sudo pip install pygame只会使用linux自带的基础python

标签: python ubuntu anaconda


【解决方案1】:

您正在将东西安装到系统 Python 中。您需要使用pip install pygame 安装到Anaconda Python 中(注意sudo pip 可能会再次使用系统Python,并且无论如何不建议将sudo 与Anaconda Python 一起使用)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-06-27
    • 1970-01-01
    • 2016-05-24
    • 1970-01-01
    • 2018-06-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多