【问题标题】:Anaconda: installing Python modulesAnaconda:安装 Python 模块
【发布时间】:2016-05-24 07:56:06
【问题描述】:

我刚刚在 Mac OSX Yosemite 上安装了 Anaconda,它已经启动并运行,包括 Python,尽管我认为当我尝试“pip install”新模块时我的路径有问题。

“which python”和“which pip”命令都指向我的 Anaconda 文件夹。此外,执行“pip install webbpsf”似乎可以通过,但该模块没有出现在“conda 列表”中,也没有在我运行脚本时被导入(ImportError:没有名为 webbpsf 的模块)。

我尝试使用“python setup.py install”手动(从下载的模块目录)安装 webbpsf 模块,但我收到一个错误,我认为该错误指向问题的根源,即 /username/ py-lib/ 路径。见下文:

Checking .pth file support in /username/py-lib/
/username/anaconda/bin/python -E -c pass
TEST FAILED: /username/py-lib/ does NOT support .pth files
error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/username/py-lib/

and your PYTHONPATH environment variable currently contains:

'/username/anaconda/lib/python2.7/site-packages'

Here are some of your options for correcting the problem:

* You can choose a different installation directory, i.e., one that is
  on PYTHONPATH or supports .pth files

* You can add the installation directory to the PYTHONPATH environment
  variable.  (It must then also be on PYTHONPATH whenever you run
  Python and want to use the package(s) you are installing.)

* You can set up the installation directory to support ".pth" files by
  using one of the approaches described here:

  https://pythonhosted.org/setuptools/easy_install.html#custom-installation-locations

我深入挖掘以尝试找到此 /py-lib/ 路径的设置位置/方式,但我查看了推荐的链接但无济于事。我在这里错过了什么?

【问题讨论】:

标签: python anaconda


【解决方案1】:

我的问题是目录 /username/py-lib/(以及 /username/py-bin/)被强制设置在 ~/.pydistutils.cfg 中。我删除了文件,然后“pip install 不管模块”做了它应该做的事情。

【讨论】:

    【解决方案2】:

    尝试使用anaconda文件夹中的python bin文件来安装setup.py文件。

    【讨论】:

    • 刚刚尝试过同样的错误信息。 python setup.py install 肯定有一些配置设置了有问题的目录,但是我好像找不到。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-27
    • 1970-01-01
    • 1970-01-01
    • 2017-01-02
    相关资源
    最近更新 更多