Python Pip Install" Egg"错误(熊猫和其他模块)

时间:2015-01-01 17:58:29

标签: python macos install pip easy-install

安装一些python模块(例如pandas)时出现问题,并且在安装ipython notebook时遇到了一些问题。

此错误似乎已经出现在其他人(Python pip install fails: invalid command egg_info)之前,但是他们使用的是Python 2.7,而我使用的是2.6(默认使用我的Mac OS 10.6)。我也试过easy_install -U setuptools和pip install --upgrade setuptools但是都没有用。

这是我安装pandas的错误:

Command python setup.py egg_info failed with error code 1 in /private/var/folders/Wm/WmmbYincEnuCrAMtGBudAk+++TM/-Tmp-/pip_build_AWal/pandas
Storing debug log for failure in /Users/AWal/Library/Logs/pip.log

对于安装iPython,这是我得到的错误:

Exception:
Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/req.py", line 671, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/req.py", line 901, in move_wheel_files
    pycompile=self.pycompile,
  File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/wheel.py", line 341, in move_wheel_files
    generated.extend(maker.make_multiple(['%s = %s' % kv for kv in console.items()]))
  File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 316, in make_multiple
    filenames.extend(self.make(specification, options))
  File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 305, in make
    self._make_script(entry, filenames, options=options)
  File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 209, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 189, in _write_script
    self._fileop.write_binary_file(outname, script_bytes)
  File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/util.py", line 384, in write_binary_file
    with open(path, 'wb') as f:
IOError: [Errno 13] Permission denied: '/usr/local/bin/sphinx-apidoc'

Storing debug log for failure in /Users/AWal/Library/Logs/pip.log

有关该怎么做的任何想法?

更新:

当我做sudo pip安装pandas(我无法安装的另一个模块)时,我会得到一个很长的回溯,并带有结束错误消息:

RuntimeError: Broken toolchain: cannot link a simple C program

并且追溯(大约100行的样本)如下所示:

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/private/tmp/pip_build_root/pandas/setup.py", line 619, in <module>

    **setuptools_kwargs)

  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py", line 113, in setup

  File "build/bdist.macosx-10.6-universal/egg/setuptools/dist.py", line 266, in __init__

  File "build/bdist.macosx-10.6-universal/egg/setuptools/dist.py", line 312, in fetch_build_eggs

  File "build/bdist.macosx-10.6-universal/egg/pkg_resources/__init__.py", line 753, in resolve

  File "build/bdist.macosx-10.6-universal/egg/pkg_resources/__init__.py", line 1005, in best_match

  File "build/bdist.macosx-10.6-universal/egg/pkg_resources/__init__.py", line 1017, in obtain

  File "build/bdist.macosx-10.6-universal/egg/setuptools/dist.py", line 379, in fetch_build_egg

  File "build/bdist.macosx-10.6-universal/egg/setuptools/command/easy_install.py", line 619, in easy_install

2 个答案:

答案 0 :(得分:0)

权限拒绝消息会建议您按照Hackaholic的建议以root身份运行命令。 试试sudo pip install YOUR_PACKAGE

您可能还想查看virtualenv以使用更加孤立的环境。 在基于debian的发行版中,您可以使用apt-get install python-virtualenv安装python-virtualenv包。

然后通过键入virtualenv whatever创建一个虚拟环境名称(这将在当前文件夹中创建一个文件夹whatever。 然后cd到它并键入bin / activate以进入此虚拟环境。 从那里再次尝试pip install命令。

可能会有帮助

更新: 您可以尝试使用建议的解决方案here

总结一下,尝试在export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future

中添加~/.bash_profile

答案 1 :(得分:0)

此问题首先出现在Google中,但second实际上有效:

pip install -U setuptools

pip install ez_setup