首页 文章

Anaconda:安装Python模块

提问于
浏览
0

我刚刚在Mac OSX Yosemite上安装了Anaconda,我已经启动并运行,包括Python,虽然我认为当我尝试“pip安装”新模块时,我的路径出了问题 .

“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 / path设置的位置和方式,我查看推荐的链接无济于事 . 我在这里想念的是什么?

2 回答

  • 0

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

  • 0

    我的问题是目录/ username / py-lib /(以及/ username / py-bin /)在〜/ .pydistutils.cfg中强制设置 . 我删除该文件,“pip install whatever_module”执行它应该做的事情 .

相关问题