Mac OS X error: directory that is not on PYTHONPATH and which Python does not read ".pth" files from

Mac OS X error: directory that is not on PYTHONPATH and which Python does not read ".pth" files from

我在 Mac OS X 10.11.6 上尝试安装 FENicS 时遇到错误。我已经阅读了本网站上对类似问题的答复,并尝试了建议的解决方案,但我一定是做错了什么。

在 运行 命令上:

curl -s https://fenicsproject.org/fenics-install.sh | bash

安装 cython 包时出现错误:

[cython] Building cython/e2t4ieqlgjl3, follow log with:  
[cython]   tail -f /Users/sophiaw/.hashdist/tmp/cython-e2t4ieqlgjl3-1/_hashdist/build.log
[cython|ERROR] Command '[u'/bin/bash', '_hashdist/build.sh']' returned non-zero exit status 1
[cython|ERROR] command failed (code=1); raising.

来自build.log的消息是:

Checking .pth file support in /Users/sophiaw/.hashdist/bld/cython/e2t4ieqlgjl3/lib/python2.7/site-packages/ /Users/sophiaw/.hashdist/bld/python/pf77qttkbtzn/bin/python -E -c pass

TEST FAILED: /Users/sophiaw/.hashdist/bld/cython/e2t4ieqlgjl3/lib/python2.7/site-packages/ 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:

/Users/sophiaw/.hashdist/bld/cython/e2t4ieqlgjl3/lib/python2.7/site-packages/

and your PYTHONPATH environment variable currently contains: '/Users/sophiaw/.hashdist/bld/cython/e2t4ieqlgjl3/Python.framework/Versions/2.7/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

Please make the appropriate changes for your system and try again.

我尝试将其添加到 bash_profile,但出现相同的错误:

export PYTHONPATH=/Users/sophiaw/.hashdist/bld/cython/e2t4ieqlgjl3/lib/python2.7/site-packages:$PYTHONPATH.

我该如何解决这个错误?

这已由 fenics 支持小组解决。在 OS X 上安装 FEniCS,Docker 是一个更方便的选择。