无法在mac osx上安装setuptools - 错误的安装目录或PYTHONPATH

时间:2017-12-22 06:57:21

标签: python macos install setuptools easy-install

我一直在尝试安装setuptools来获取easy_install。

我正在执行以下操作安装:

curl https://bootstrap.pypa.io/ez_setup.py -o - | python

但我一直收到以下错误:

Installing Setuptools
running install
Checking .pth file support in /lib/python2.7/site-packages/
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -E -c pass
TEST FAILED: /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:

    /lib/python2.7/site-packages/

and your PYTHONPATH environment variable currently contains:

    '/usr/local/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://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations

我该怎么做才能解决这个问题?当我的PYTHONPATH为/lib/python2.7/site-packages/ ??

时,为什么要检查/usr/local/lib/python2.7/site-packages/
which python

输出:/usr/local/bin/python

echo $ PYTHONPATH

输出:/usr/local/lib/python2.7/site-packages/

echo $PATH

输出:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

请帮忙!!我一直在网上搜索,但无法解决这个问题。

顺便说一下,我正在使用Mac osx Sierra。

更新:

我甚至从https://pypi.python.org/pypi/setuptools

下载了zip

解压缩文件夹,然后cd进去。然后我跑了:

sudo python setup.py build
sudo python setup.py install

这给了我同样的错误!!

0 个答案:

没有答案