pip install抛出MissingSectionHeaderError

时间:2017-04-29 05:08:38

标签: python macos pip easy-install

Pip版本:9.0.1

Python版本:2.7.13

操作系统:Mac OS

当我点击安装任何东西时,

MissingSectionHeaderError被抛出。我特意试图运行sudo pip install --upgrade virtualenv

我尝试过的事情:

我试图卸载python3并重新安装python3(无法卸载python2)

我试图直接重新下载点子(从这里开始:https://bootstrap.pypa.io/

这是错误:

Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 247, in move_wheel_files
    prefix=prefix,
  File "/usr/local/lib/python2.7/site-packages/pip/locations.py", line 141, in distutils_scheme
    d.parse_config_files()
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 390, in parse_config_files
    parser.read(filename)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ConfigParser.py", line 305, in read
    self._read(fp, filename)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ConfigParser.py", line 512, in _read
    raise MissingSectionHeaderError(fpname, lineno, line)
MissingSectionHeaderError: File contains no section headers.
file: setup.cfg, line: 7
'<!DOCTYPE html>\n'

我已经尝试sudo find / | grep setup.cfg找到setup.cfg个文件,并将它们与正在运行的系统进行比较,并且它们是相同的。

我尝试cd进入/usr/local/lib/python3.6/site-packages/pip并执行python3 __main__.py install --upgrade virtualenv并说它已安装且错误未被抛出。但是,我不知道它的安装位置(这应该可以通过pip来实现,因为没有pip运行这个脚本吗?)

对于发生的事情非常难过。如果您需要任何其他信息,请与我们联系。

1 个答案:

答案 0 :(得分:0)

我有一个类似的问题:pip install...运行configparser.MissingSectionHeaderError: File contains no section headers.失败

在我的情况下,运行pip install -U pip解决了该错误,并且我能够安装软件包。