在mac上安装python2.7的setuptools时遇到问题

时间:2016-01-05 09:38:16

标签: python-2.7 setuptools

到目前为止,我已经尝试了两种方法在this instruction之后的mac上为python2.7安装setuptools 19.2,但我不断收到错误消息:

Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-19.2.zip
Extracting in /tmp/tmpY063sV
Now working in /tmp/tmpY063sV/setuptools-19.2
Installing Setuptools
running install
Checking .pth file support in /Library/Python/2.7/site-packages/
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-5577.pth'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /Library/Python/2.7/site-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  https://pythonhosted.org/setuptools/easy_install.html

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

Something went wrong during the installation.
See the error message above.

所以我尝试了另一种方式curl https://bootstrap.pypa.io/ez_setup.py -o - | python,但仍然遇到了同样的错误。所以根据这个回复,这与我放置ez_setup.py的目录有关?或者还有什么东西在这里玩?

更新

使用sudosudo !!命令

收到错误

还尝试sudo chown -R $USER /Library/Python/2.7然后安装它,得到以下消息:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12059  100 12059    0     0  52776      0 --:--:-- --:--:-- --:--:-- 52890
Extracting in /tmp/tmpLslK5J
Now working in /tmp/tmpLslK5J/setuptools-19.2
Installing Setuptools
running install
Checking .pth file support in /Library/Python/2.7/site-packages/
/usr/bin/python -E -c pass
TEST PASSED: /Library/Python/2.7/site-packages/ appears to support .pth files
running bdist_egg
running egg_info
writing requirements to setuptools.egg-info/requires.txt
writing setuptools.egg-info/PKG-INFO
writing top-level names to setuptools.egg-info/top_level.txt
writing dependency_links to setuptools.egg-info/dependency_links.txt
writing entry points to setuptools.egg-info/entry_points.txt
reading manifest file 'setuptools.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'setuptools.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.11-intel/egg
running install_lib
running build_py
creating build
creating build/lib
copying easy_install.py -> build/lib
creating build/lib/_markerlib
copying _markerlib/__init__.py -> build/lib/_markerlib
copying _markerlib/markers.py -> build/lib/_markerlib
creating build/lib/pkg_resources
copying pkg_resources/__init__.py -> build/lib/pkg_resources
creating build/lib/setuptools
copying setuptools/__init__.py -> build/lib/setuptools
copying setuptools/archive_util.py -> build/lib/setuptools
copying setuptools/compat.py -> build/lib/setuptools
copying setuptools/depends.py -> build/lib/setuptools
copying setuptools/dist.py -> build/lib/setuptools
copying setuptools/extension.py -> build/lib/setuptools
copying setuptools/lib2to3_ex.py -> build/lib/setuptools
copying setuptools/msvc9_support.py -> build/lib/setuptools
copying setuptools/package_index.py -> build/lib/setuptools
copying setuptools/py26compat.py -> build/lib/setuptools
copying setuptools/py27compat.py -> build/lib/setuptools
copying setuptools/py31compat.py -> build/lib/setuptools
copying setuptools/sandbox.py -> build/lib/setuptools
copying setuptools/site-patch.py -> build/lib/setuptools
copying setuptools/ssl_support.py -> build/lib/setuptools
copying setuptools/unicode_utils.py -> build/lib/setuptools
copying setuptools/utils.py -> build/lib/setuptools
copying setuptools/version.py -> build/lib/setuptools
copying setuptools/windows_support.py -> build/lib/setuptools
creating build/lib/pkg_resources/_vendor
copying pkg_resources/_vendor/__init__.py -> build/lib/pkg_resources/_vendor
creating build/lib/pkg_resources/_vendor/packaging
copying pkg_resources/_vendor/packaging/__about__.py -> build/lib/pkg_resources/_vendor/packaging
copying pkg_resources/_vendor/packaging/__init__.py -> build/lib/pkg_resources/_vendor/packaging
copying pkg_resources/_vendor/packaging/_compat.py -> build/lib/pkg_resources/_vendor/packaging
copying pkg_resources/_vendor/packaging/_structures.py -> build/lib/pkg_resources/_vendor/packaging
copying pkg_resources/_vendor/packaging/specifiers.py -> build/lib/pkg_resources/_vendor/packaging
copying pkg_resources/_vendor/packaging/version.py -> build/lib/pkg_resources/_vendor/packaging
creating build/lib/setuptools/command
copying setuptools/command/__init__.py -> build/lib/setuptools/command
copying setuptools/command/alias.py -> build/lib/setuptools/command
copying setuptools/command/bdist_egg.py -> build/lib/setuptools/command
copying setuptools/command/bdist_rpm.py -> build/lib/setuptools/command
copying setuptools/command/bdist_wininst.py -> build/lib/setuptools/command
copying setuptools/command/build_ext.py -> build/lib/setuptools/command
copying setuptools/command/build_py.py -> build/lib/setuptools/command
copying setuptools/command/develop.py -> build/lib/setuptools/command
copying setuptools/command/easy_install.py -> build/lib/setuptools/command
copying setuptools/command/egg_info.py -> build/lib/setuptools/command
copying setuptools/command/install.py -> build/lib/setuptools/command
copying setuptools/command/install_egg_info.py -> build/lib/setuptools/command
copying setuptools/command/install_lib.py -> build/lib/setuptools/command
copying setuptools/command/install_scripts.py -> build/lib/setuptools/command
copying setuptools/command/register.py -> build/lib/setuptools/command
copying setuptools/command/rotate.py -> build/lib/setuptools/command
copying setuptools/command/saveopts.py -> build/lib/setuptools/command
copying setuptools/command/sdist.py -> build/lib/setuptools/command
copying setuptools/command/setopt.py -> build/lib/setuptools/command
copying setuptools/command/test.py -> build/lib/setuptools/command
copying setuptools/command/upload_docs.py -> build/lib/setuptools/command
copying setuptools/script (dev).tmpl -> build/lib/setuptools
copying setuptools/script.tmpl -> build/lib/setuptools
creating build/bdist.macosx-10.11-intel
creating build/bdist.macosx-10.11-intel/egg
creating build/bdist.macosx-10.11-intel/egg/_markerlib
copying build/lib/_markerlib/__init__.py -> build/bdist.macosx-10.11-intel/egg/_markerlib
copying build/lib/_markerlib/markers.py -> build/bdist.macosx-10.11-intel/egg/_markerlib
copying build/lib/easy_install.py -> build/bdist.macosx-10.11-intel/egg
creating build/bdist.macosx-10.11-intel/egg/pkg_resources
copying build/lib/pkg_resources/__init__.py -> build/bdist.macosx-10.11-intel/egg/pkg_resources
creating build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor
copying build/lib/pkg_resources/_vendor/__init__.py -> build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor
creating build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor/packaging
copying build/lib/pkg_resources/_vendor/packaging/__about__.py -> build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor/packaging
copying build/lib/pkg_resources/_vendor/packaging/__init__.py -> build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor/packaging
copying build/lib/pkg_resources/_vendor/packaging/_compat.py -> build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor/packaging
copying build/lib/pkg_resources/_vendor/packaging/_structures.py -> build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor/packaging
copying build/lib/pkg_resources/_vendor/packaging/specifiers.py -> build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor/packaging
copying build/lib/pkg_resources/_vendor/packaging/version.py -> build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor/packaging
creating build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/__init__.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/archive_util.py -> build/bdist.macosx-10.11-intel/egg/setuptools
creating build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/__init__.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/alias.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/bdist_egg.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/bdist_rpm.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/bdist_wininst.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/build_ext.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/build_py.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/develop.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/easy_install.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/egg_info.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/install.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/install_egg_info.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/install_lib.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/install_scripts.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/register.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/rotate.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/saveopts.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/sdist.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/setopt.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/test.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/command/upload_docs.py -> build/bdist.macosx-10.11-intel/egg/setuptools/command
copying build/lib/setuptools/compat.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/depends.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/dist.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/extension.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/lib2to3_ex.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/msvc9_support.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/package_index.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/py26compat.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/py27compat.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/py31compat.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/sandbox.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/script (dev).tmpl -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/script.tmpl -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/site-patch.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/ssl_support.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/unicode_utils.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/utils.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/version.py -> build/bdist.macosx-10.11-intel/egg/setuptools
copying build/lib/setuptools/windows_support.py -> build/bdist.macosx-10.11-intel/egg/setuptools
byte-compiling build/bdist.macosx-10.11-intel/egg/_markerlib/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/_markerlib/markers.py to markers.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/easy_install.py to easy_install.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/pkg_resources/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor/packaging/__about__.py to __about__.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor/packaging/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor/packaging/_compat.py to _compat.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor/packaging/_structures.py to _structures.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor/packaging/specifiers.py to specifiers.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/pkg_resources/_vendor/packaging/version.py to version.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/archive_util.py to archive_util.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/alias.py to alias.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/bdist_egg.py to bdist_egg.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/bdist_rpm.py to bdist_rpm.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/bdist_wininst.py to bdist_wininst.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/build_ext.py to build_ext.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/build_py.py to build_py.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/develop.py to develop.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/easy_install.py to easy_install.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/egg_info.py to egg_info.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/install.py to install.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/install_egg_info.py to install_egg_info.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/install_lib.py to install_lib.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/install_scripts.py to install_scripts.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/register.py to register.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/rotate.py to rotate.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/saveopts.py to saveopts.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/sdist.py to sdist.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/setopt.py to setopt.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/test.py to test.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/command/upload_docs.py to upload_docs.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/compat.py to compat.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/depends.py to depends.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/dist.py to dist.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/extension.py to extension.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/lib2to3_ex.py to lib2to3_ex.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/msvc9_support.py to msvc9_support.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/package_index.py to package_index.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/py26compat.py to py26compat.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/py27compat.py to py27compat.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/py31compat.py to py31compat.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/sandbox.py to sandbox.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/site-patch.py to site-patch.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/ssl_support.py to ssl_support.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/unicode_utils.py to unicode_utils.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/utils.py to utils.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/version.py to version.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/setuptools/windows_support.py to windows_support.pyc
creating build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying setuptools.egg-info/PKG-INFO -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying setuptools.egg-info/SOURCES.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying setuptools.egg-info/dependency_links.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying setuptools.egg-info/entry_points.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying setuptools.egg-info/requires.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying setuptools.egg-info/top_level.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying setuptools.egg-info/zip-safe -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
creating dist
creating 'dist/setuptools-19.2-py2.7.egg' and adding 'build/bdist.macosx-10.11-intel/egg' to it
removing 'build/bdist.macosx-10.11-intel/egg' (and everything under it)
Processing setuptools-19.2-py2.7.egg
Removing /Library/Python/2.7/site-packages/setuptools-19.2-py2.7.egg
Copying setuptools-19.2-py2.7.egg to /Library/Python/2.7/site-packages
setuptools 19.2 is already the active version in easy-install.pth
Installing easy_install script to /usr/local/bin
error: [Errno 2] No such file or directory: '/usr/local/bin/easy_install'
Something went wrong during the installation.
See the error message above.

1 个答案:

答案 0 :(得分:1)

您似乎没有Python文件夹的权限  要使用sudo权限运行上一个命令(导致错误),只需运行sudo !!即可运行。

或者,您可以运行sudo chown -R $USER /Library/Python/2.7然后正常安装。

修改:您的新错误消息为:

error: [Errno 2] No such file or directory: '/usr/local/bin/easy_install'

您可以通过以下方式创建该目录:

mkdir /usr/local/bin/easy_install

然后再尝试安装。