编程语言
首页 > 编程语言> > 在Reddit安装中解决Python包版本冲突

在Reddit安装中解决Python包版本冲突

作者:互联网

我正在尝试在我的Mac上安装Reddit的Python库.我想使用PyCharm进行开发,因为我喜欢它作为Python IDE.

我在Virtual Box实例中运行Cassandra,Memcached,RabbitMQ和Postgres服务器,可通过Virtual Box Host-only适配器访问.这是有效的,因为我可以在虚拟盒中启动Reddit并从我的Mac访问它就好了.

运行paster脚本时,看看Reddit Python源安装是否在Mac上运行.我收到以下错误:

    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′.

‘pip list’显示安装的这些包:

amqplib (1.0.2)
Babel (0.9.6)
bcrypt (1.0.2)
Beaker (1.6.4)
BeautifulSoup (3.2.1)
beautifulsoup4 (4.2.1)
boto (2.9.5)
cffi (0.6)
chardet (2.1.1)
crypto (1.1.0)
cssutils (0.9.5.1)
Cython (0.19.1)
decorator (3.4.0)
FormEncode (1.2.6)
kazoo (1.1)
l2cs (2.0.2)
lxml (3.2.1)
Mako (0.8.1)
MarkupSafe (0.18)
nose (1.3.0)
Paste (1.7.5.1)
PasteDeploy (1.5.0)
PasteScript (1.7.5)
PIL (1.1.7)
psycopg2 (2.5)
py-bcrypt (0.3)
pyasn1 (0.1.7)
PyCAPTCHA (0.4)
pycassa (1.9.0)
pycountry (0.14.8)
pycparser (2.09.1)
pycrypto (2.6)
Pygments (1.6)
pylibmc (1.2.3)
Pylons (0.9.7)
pytz (2013b)
repoze.lru (0.6)
requests (1.2.3)
Routes (1.11)
rsa (3.1.1)
simplejson (3.3.0)
six (1.3.0)
snudown (1.1.5)
SQLAlchemy (0.7.4)
stripe (1.9.1)
Tempita (0.5.1)
thrift (0.9.0)
waitress (0.8.5)
WebError (0.10.3)
WebHelpers (1.3)
WebOb (1.2.3)
WebTest (2.0.6)
Whoosh (2.4.1)
wsgiref (0.1.2)
zope.interface (4.0.5)

我的假设是这些软件包中至少有一个需要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,Objective C等,但还不是专业的Python程序员.所以Python包系统在这一点上对我来说太过黑了.我可以使用pip并运行setup.py脚本,但我还没有理解它们.

解决方法:

问题来自拥有WebTest库的2.0.6版本.此版本是需要WebOb> = 1.2的版本.

确定python模块的要求.我进入了虚拟环境的site-packages目录,然后运行:

grep WebOb *.egg-info/requires.txt

返回:

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,然后运行:

pip install webob==1.0.8
pip install webtest==1.3.3

这摆脱了WebOb版本冲突的冲突.我仍然无法让Reddit运行,但至少我删除了这个块.

标签:python,python-2-7,reddit
来源: https://codeday.me/bug/20190620/1243521.html