编程语言
首页 > 编程语言> > 安装OS X 10.8 macports后python pip无法在requirements.txt上运行

安装OS X 10.8 macports后python pip无法在requirements.txt上运行

作者:互联网

最近购买了一台新的Mac,并将其设置用于Python和iOS开发. Python运行良好-尤其是在git repos上添加了许多requirements.txt依赖项.直到我安装Xcode,macports和Apple的命令行工具.

现在pip可以很好地用于单个安装(例如pip install twilio),但是每当我对requirements.txt文件运行pip时,它都会失败(带有或不带有sudo):

pip install ./requirements.txt
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/basecommand.py", line 107, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/commands/install.py", line 225, in run
    InstallRequirement.from_line(name, None))
  File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 118, in from_line
    return cls(req, comes_from, url=url)
  File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 43, in __init__
    req = pkg_resources.Requirement.parse(req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2510, in parse
    reqs = list(parse_requirements(s))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2436, in parse_requirements
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2404, in scan_list
raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', './requirements.txt', 'at', '/requirements.txt')

我的$PATH值是

/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin

这看起来与“ OS X 10.8升级后Python点中断”线程不同.我不知道macports是否会在/ System / Libary和〜/ Library中查找之间产生冲突.

有任何想法吗?

解决方法:

如果要通过需求文件安装软件包,则需要–requirement / -r选项:

$pip install -r requirements.txt

标签:macports,requirements-txt,python,macos,pip
来源: https://codeday.me/bug/20191031/1976042.html