从最新的apt-get upgrade
14.04 机器上开始,所有 Python 脚本都失败了。
下面的一行代码触发了这个问题:
$ python -c 'from pkg_resources import load_entry_point'
更完整的工作流程:
$ virtualenv --system-site-packages myenv $ source myenv/bin/activate $ pip install cryptography ... Successfully installed cryptography idna pyasn1 setuptools enum34 ipaddress appdirs packaging $ pip freeze Traceback (most recent call last): File "/home/milton/workdir/myenv/bin/pip", line 7, in <module> from pip import main File "/home/milton/workdir/myenv/local/lib/python2.7/site-packages/pip/__init__.py", line 9, in <module> from pip.log import logger File "/home/milton/workdir/myenv/local/lib/python2.7/site-packages/pip/log.py", line 9, in <module> from pip._vendor import colorama, pkg_resources File "/home/milton/workdir/myenv/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources.py", line 2717, in <module> add_activation_listener(lambda dist: dist.activate()) File "/home/milton/workdir/myenv/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources.py", line 682, in subscribe callback(dist) File "/home/milton/workdir/myenv/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources.py", line 2717, in <lambda> add_activation_listener(lambda dist: dist.activate()) File "/home/milton/workdir/myenv/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources.py", line 2255, in activate list(map(declare_namespace, self._get_metadata('namespace_packages.txt'))) File "/home/milton/workdir/myenv/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources.py", line 1863, in declare_namespace _handle_ns(packageName, path_item) File "/home/milton/workdir/myenv/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources.py", line 1832, in _handle_ns loader.load_module(packageName) File "/usr/lib/python2.7/pkgutil.py", line 246, in load_module mod = imp.load_module(fullname, self.file, self.filename, self.etc) File "/usr/lib/python2.7/dist-packages/zope/__init__.py", line 3, in <module> import pkg_resources File "/home/milton/workdir/myenv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 72, in <module> import packaging.requirements File "/home/milton/workdir/myenv/local/lib/python2.7/site-packages/packaging/requirements.py", line 59, in <module> MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker") TypeError: __call__() takes exactly 2 arguments (1 given)
我已安装软件包的列表
dh-python doxygen fabric ipython libclone-perl libfile-copy-recursive-perl libpython-dev:amd64 libpython-stdlib:amd64 libpython2.7:amd64 libpython2.7-dev:amd64 libpython2.7-minimal:amd64 libpython2.7-stdlib:amd64 libpython3-stdlib:amd64 libpython3.4:amd64 libpython3.4-minimal:amd64 libpython3.4-stdlib:amd64 libpyzy-1.0-0 liburcu1 pydb pylint python python-apt python-apt-common python-aptdaemon python-aptdaemon.gtk3widgets python-astroid python-autopilot python-autopilot-trace python-blockdiag python-boto python-bzrlib python-cairo python-chardet python-chardet-whl python-clang-3.6 python-cloudfiles python-colorama python-colorama-whl python-commandnotfound python-compizconfig python-configobj python-contextlib2 python-crypto python-cups python-cupshelpers python-dateutil python-dbus python-dbus-dev python-debian python-debtagshw python-decorator python-defer python-dev python-dirspec python-distlib python-distlib-whl python-distro-info python-docutils python-egenix-mxdatetime python-egenix-mxtools python-extras python-fixtures python-funcparserlib python-gconf python-gdbm python-gevent python-gi python-gi-cairo python-glade2 python-gnomekeyring python-gobject python-gobject-2 python-gpgme python-greenlet python-gst-1.0 python-gtk2 python-html5lib python-html5lib-whl python-httplib2 python-ibus python-imaging python-jinja2 python-junitxml python-keyring python-launchpadlib python-lazr.restfulclient python-lazr.uri python-ldb python-libxml2 python-lockfile python-logilab-common python-lxml python-markupsafe python-matplotlib python-matplotlib-data python-migrate python-mimeparse python-minimal python-mysqldb python-nose python-notify python-ntdb python-numpy python-oauth python-oauthlib python-oneconf python-opencv python-openssl python-pam python-paramiko python-pbr python-pexpect python-pil python-pip python-pip-whl python-piston-mini-client python-pkg-resources python-psutil python-pyatspi python-pyatspi2 python-pycurl python-pygame python-pygments python-pyparsing python-qt4 python-qt4-dbus python-renderpm python-reportlab python-reportlab-accel python-requestbuilder python-requests python-requests-whl python-roman python-samba python-scipy python-scour python-secretstorage python-serial python-setuptools python-setuptools-whl python-simplegeneric python-simplejson python-sip python-six python-six-whl python-smbc python-sqlalchemy python-sqlalchemy-ext python-subunit python-support python-talloc python-tdb python-tempita python-testscenarios python-testtools python-tk python-tornado python-twisted-bin python-twisted-core python-twisted-mail python-twisted-names python-twisted-web python-twisted-words python-tz python-ubuntu-sso-client python-urllib3 python-urllib3-whl python-virtualenv python-wadllib python-webcolors python-wheel python-xapian python-xdg python-zeitgeist python-zope.interface python2.7 python2.7-dev python2.7-minimal python3 python3-apparmor python3-apparmor-click python3-apport python3-apt python3-aptdaemon python3-aptdaemon.gtk3widgets python3-aptdaemon.pkcompat python3-autopilot python3-autopilot-trace python3-autopilot-vis python3-brlapi python3-cairo python3-chardet python3-checkbox-ng python3-checkbox-support python3-click python3-commandnotfound python3-crypto python3-dateutil python3-dbus python3-dbus.mainloop.qt python3-debian python3-decorator python3-defer python3-distupgrade python3-evdev python3-extras python3-feedparser python3-fixtures python3-gdbm:amd64 python3-gi python3-gi-cairo python3-httplib2 python3-jinja2 python3-junitxml python3-libapparmor python3-louis python3-lxc python3-lxml python3-mako python3-markupsafe python3-mimeparse python3-minimal python3-oauthlib python3-oneconf python3-pil python3-piston-mini-client python3-pkg-resources python3-plainbox python3-problem-report python3-psutil python3-pyatspi python3-pycurl python3-pyparsing python3-pyqt4 python3-requests python3-sip python3-six python3-software-properties python3-speechd python3-subunit python3-testscenarios python3-testtools python3-uno python3-update-manager python3-urllib3 python3-xdg python3-xkit python3-xlib python3.4 python3.4-minimal rsync