Debian
pip install 給出“TypeError:‘int’對像不可迭代”
在Debian Stretch中,當我嘗試通過安裝 python 包 python-constraint
pip install python-constraint
我收到以下錯誤;
Exception: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main status = self.run(options, args) File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 290, in run requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1178, in prepare_files url = finder.find_requirement(req_to_install, upgrade=self.upgrade) File "/usr/lib/python2.7/dist-packages/pip/index.py", line 292, in find_requirement elif is_prerelease(version) and not (self.allow_all_prereleases or req.prereleases): File "/usr/lib/python2.7/dist-packages/pip/util.py", line 739, in is_prerelease return any([any([y in set(["a", "b", "c", "rc", "dev"]) for y in x]) for x in parsed]) TypeError: 'int' object is not iterable Storing debug log for failure in /home/von/.pip/pip.log
在Debian Jessie中,同樣的命令是成功的。
哪裡有問題?如何解決?
$python --version Python 2.7.9 $pip --version pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)
該錯誤與錯誤有關https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=786580
解決方案是降級
python-distlib
並python-distlib-whl
到 jessie 版本。wget http://ftp.debian.org/debian/pool/main/d/distlib/python-distlib_0.1.9-1_all.deb wget http://ftp.debian.org/debian/pool/main/d/distlib/python-distlib-whl_0.1.9-1_all.deb dpkg -i python-distlib_0.1.9-1_all.deb dpkg -i python-distlib-whl_0.1.9-1_all.deb
之後執行
pip install
就成功了。$ sudo pip install python-constraint Downloading/unpacking python-constraint Downloading python-constraint-1.2.tar.bz2 Running setup.py (path:/tmp/pip-build-JeOIzg/python-constraint/setup.py) egg_info for package python-constraint Installing collected packages: python-constraint Running setup.py install for python-constraint Successfully installed python-constraint Cleaning up...
將軟體包擱置,等待官方的錯誤修復。
sudo aptitude hold python-distlib python-distlib-whl