我正在开发一个网络浏览器扩展程序,并且找到了一个工具,允许我从单个代码库发布所有浏览器的扩展程序。该工具名为Open Forge,由Trigger.io开发。
Open Forge自述文件中列出的设置说明(包含在上面的链接中)涉及创建和配置新的python环境。我已经能够在项目目录中创建和激活新的python环境,但是配置环境的命令(pip install -r requirements.txt)会生成以下异常:
Exception:
Traceback (most recent call last):
File "C:\Users\ian\Documents\Kitchology\browser-extensions\python-env\lib\site
-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\ian\Documents\Kitchology\browser-extensions\python-env\lib\site
-packages\pip\commands\install.py", line 347, in run
root=options.root_path,
File "C:\Users\ian\Documents\Kitchology\browser-extensions\python-env\lib\site
-packages\pip\req\req_set.py", line 497, in install
and req.installed_version in distribute_req):
File "C:\Users\ian\Documents\Kitchology\browser-extensions\python-env\lib\site
-packages\pip\_vendor\pkg_resources.py", line 2851, in __contains__
return self.specifier.contains(item, prereleases=True)
File "C:\Users\ian\Documents\Kitchology\browser-extensions\python-env\lib\site
-packages\pip\_vendor\packaging\specifiers.py", line 651, in contains
item = parse(item)
File "C:\Users\ian\Documents\Kitchology\browser-extensions\python-env\lib\site
-packages\pip\_vendor\packaging\version.py", line 41, in parse
return Version(version)
File "C:\Users\ian\Documents\Kitchology\browser-extensions\python-env\lib\site
-packages\pip\_vendor\packaging\version.py", line 202, in __init__
match = self._regex.search(version)
TypeError: expected string or buffer
该过程在requirements.txt文档的第17行挂起。有问题的一行是:
PyHamcrest == 1.6
我也在Unix(OS X)上尝试过这个过程并遇到了同样的错误。
我可以通过在requirements.txt中指定最新版本的PyHamcrest(1.8)来成功完成该过程。我之前从未使用过PyHamcrest,并且不清楚为什么1.8可以使用,而1.6则没有。