gpt4 book ai didi

python - Anaconda:安装 Python 模块

转载 作者:太空宇宙 更新时间:2023-11-03 16:56:40 30 4
gpt4 key购买 nike

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

“which python”和“which pip”命令都指向我的 Anaconda 文件夹。此外,执行“pip install webbpsf”似乎可以完成,但该模块不会出现在“conda list”中,当我运行脚本时也不会导入它(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/路径的设置位置/方式,并且我查看了推荐的链接,但无济于事。我在这里缺少什么?

最佳答案

我的问题是目录/username/py-lib/(以及/username/py-bin/)在 ~/.pydistutils.cfg 中被强制设置。我删除了该文件,然后“pip installwhatever_module”执行了它应该执行的操作。

关于python - Anaconda:安装 Python 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35374933/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com