【发布时间】: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/ 路径的设置位置/方式,但我查看了推荐的链接但无济于事。我在这里错过了什么?
【问题讨论】:
-
Anaconda 自带 Python。见stackoverflow.com/questions/17386880/…