由于许可理念的原因,Ubuntu 11.10 将 python-profiler 从 Python 标准库中分离出来。(根据我谷歌搜索到的信息,如果我错了,请纠正我。)
这是自 11.10 十月以来一直存在的一个错误。我安装了 Python 2.7.2,因此依赖项错误是错误的。“apt-get check”无法解决问题。
解决此问题的最佳方法是什么?谢谢。
sudo apt-get install python-profiler
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
python-profiler : Depends: python (>= 2.5) but it is not going to be installed
Depends: python (< 2.8) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
答案1
该python-profile
软件包仅包含几个.py
文件:
$ apt-file list python-profiler
python-profiler: /usr/lib/python2.5/profile.py
python-profiler: /usr/lib/python2.5/pstats.py
python-profiler: /usr/lib/python2.6/profile.py
python-profiler: /usr/lib/python2.6/pstats.py
python-profiler: /usr/lib/python2.7/profile.py
python-profiler: /usr/lib/python2.7/pstats.py
python-profiler: /usr/share/doc/python-profiler/README.Debian
python-profiler: /usr/share/doc/python-profiler/changelog.Debian.gz
python-profiler: /usr/share/doc/python-profiler/copyright
python-profiler: /usr/share/lintian/overrides/python-profiler
因此,您可以使用 下载二进制包apt-get download python-profiler
并使用 提取其内容dpkg -x python-profiler_<version>_all.deb <dir>
。获得包的内容后,只需将文件复制.py
到其位置即可使分析器模块在您的 Python 安装中可用。