Python Pip 安装“Egg”错误(Pandas 和其他模块)

问题描述 投票:0回答:2

安装某些 python 模块(例如 pandas)时遇到问题,安装 ipython 笔记本时也遇到一些问题。

其他人似乎以前也出现过此错误(Python pip install 失败:无效命令 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 install 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
python macos installation pip easy-install
2个回答
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
命令。

可能有帮助

更新: 您可以尝试使用此处

提供的建议解决方案

总而言之,尝试在

export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
 中添加 
~/.bash_profile


-1
投票

这个问题在谷歌中排在第一位,但第二个实际上有效:

pip install -U setuptools

pip install ez_setup
© www.soinside.com 2019 - 2024. All rights reserved.