解决Reddit安装中的Python包版本冲突
我正试图在我的Mac上安装Reddit的Python库。我想使用PyCharm for development运行它们,因为我喜欢它作为Python IDE 我在一个虚拟箱实例中运行Cassandra、Memcached、RabbitMQ和Postgres服务器,该实例可通过虚拟箱主机专用适配器访问。这是工作,因为我可以启动Reddit在虚拟盒,并访问它从我的Mac电脑刚刚好 运行粘贴脚本以查看Reddit Python源代码安装是否在Mac上运行时。我得到以下错误:解决Reddit安装中的Python包版本冲突,python,python-2.7,reddit,Python,Python 2.7,Reddit,我正试图在我的Mac上安装Reddit的Python库。我想使用PyCharm for development运行它们,因为我喜欢它作为Python IDE 我在一个虚拟箱实例中运行Cassandra、Memcached、RabbitMQ和Postgres服务器,该实例可通过虚拟箱主机专用适配器访问。这是工作,因为我可以启动Reddit在虚拟盒,并访问它从我的Mac电脑刚刚好 运行粘贴脚本以查看Reddit Python源代码安装是否在Mac上运行时。我得到以下错误: Traceback
Traceback (most recent call last):
File "/Users/inflector/software/new-day/reddit/dev/bin/paster", line 8, in <module>
load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
File "/Users/inflector/software/new-day/reddit/dev/lib/python2.7/site-packages/paste/script/command.py", line 93, in run
commands = get_commands()
File "/Users/inflector/software/new-day/reddit/dev/lib/python2.7/site-packages/paste/script/command.py", line 135, in get_commands
plugins = pluginlib.resolve_plugins(plugins)
File "/Users/inflector/software/new-day/reddit/dev/lib/python2.7/site-packages/paste/script/pluginlib.py", line 82, in resolve_plugins
pkg_resources.require(plugin)
File "build/bdist.linux-i686/egg/pkg_resources.py", line 666, in require
File "build/bdist.linux-i686/egg/pkg_resources.py", line 569, in resolve
pkg_resources.VersionConflict: (WebOb 1.2.3 (/Users/inflector/software/new-day/reddit/dev/lib/python2.7/site-packages), Requirement.parse('webob==1.0.8'))
我的假设是,这些包中至少有一个需要WebOb==1.0.8,而另外至少有一个需要WebOb>=1.2
我为Reddit安装了一个virtualenv,并使用--no site packages选项进行了设置,因此我只处理Reddit所需的软件包。我手动安装了我认为需要的所有东西。所以这实际上是包的最小集合。我需要每一个,但可能不是所有的都是正确的版本。Reddit安装程序没有为每个软件包指定版本,只指定其中的一些
那么我如何追踪这些依赖关系呢?如何获得virtualenv中安装的每个软件包的需求列表
文件“build/bdist.linux-i686/egg/pkg_resources.py”来自哪里?我在系统中的任何地方都找不到它。而且Mac不是linux,所以这看起来很奇怪
我是一个经验丰富的程序员,C++、java、Object Pascal、Objo C等,但还不是一个专家Python程序员。因此,Python包系统在这一点上对我来说太像一个黑盒子了。我可以使用pip并运行setup.py脚本,但我还没有尝试过它们。问题来自WebTest库的2.0.6版本。此版本要求WebOb>=1.2 确定python模块的需求。我将cd刻录到虚拟环境的site packages目录中,然后运行:
grep WebOb *.egg-info/requires.txt
pip install webob==1.0.8
pip install webtest==1.3.3
它返回:
Pylons-0.9.7-py2.7.egg-info/requires.txt:WebOb>=0.9.6.1
WebError-0.10.3-py2.7.egg-info/requires.txt:WebOb
WebTest-2.0.6-py2.7.egg-info/requires.txt:WebOb>=1.2
在这里我可以看到WebTest是一个冲突的包
然后,我可以进入我的Ubuntu安装,查看安装了什么WebTest软件包,发现WebTest 1.3.3在标准的Ubuntu Reddit安装上工作。因此,我卸载了WebOb 1.2和WebTest 2.0.6,然后运行:
grep WebOb *.egg-info/requires.txt
pip install webob==1.0.8
pip install webtest==1.3.3
这消除了WebOb版本冲突。我仍然无法让Reddit运行,但至少我删除了这个块。Reddit是一个安装程序。PPA包含许多Ubuntu python包的变体
如果你正在运行Ubuntu,你也可以安装PPA