【发布时间】:2020-02-23 21:48:37
【问题描述】:
我想通过pip 安装matplotlib。但是,我遇到了循环问题,并且在某些时候我被卡住了。在终端中运行 pip 会产生:
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3080, in <module>
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3066, in _call_aside
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3093, in _initialize_master_working_set
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 651, in _build_master
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 952, in require
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 839, in resolve
pkg_resources.DistributionNotFound: The 'pip==1.5.4' distribution was not found and is required by the application
我尝试使用easy_install 解决此问题,但它产生了以下错误消息:
Traceback (most recent call last):
File "/usr/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3080, in <module>
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3066, in _call_aside
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3093, in _initialize_master_working_set
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 653, in _build_master
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 666, in _build_from_requirements
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 839, in resolve
pkg_resources.DistributionNotFound: The 'setuptools==3.3' distribution was not found and is required by the application
运行sudo apt-get install python-setuptools 表示我已经拥有最新版本。
我的操作系统是Ubuntu 14.04。我尝试了许多不同的方法来解决这个问题,但最终可能会造成更大的伤害。我不记得我所做的一切以及我是如何在这个阶段结束的,所以很遗憾无法提供更多信息。
我的目标是最终安装 matplotlib 并让我的所有 python 相关库处于稳定状态。任何解决方案都可以,所以我不介意重新安装所有东西或任何可以解决问题的方法。
更新
运行sudo apt-get build-dep python-matplotlib 产生
Reading package lists... Done
Building dependency tree
Reading state information... Done
Picking 'matplotlib' as source package instead of 'python-matplotlib'
E: Unable to find a source package for matplotlib
而sudo apt-get install python-matplotlib 产生
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-matplotlib is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
但是,在python 中仍然找不到matplotlib。
【问题讨论】:
-
您考虑过与
virtualenv.合作吗? -
我不确定它是否会让我的生活更轻松并且更像是一种解决方法。我不知道它是如何工作的,但我从事的项目主要是一个
C项目,我们使用python来处理一些花哨的东西,所以我希望能得到更一般的修复。 -
virtualenv也可以用作一般修复程序。如果您必须分发软件而无需人们安装所有必需的库,并且在不同的机器上运行程序时,它会派上用场。设置和使用相当简单:virtualenv.pypa.io/en/stable/userguide.html -
我曾经不得不让脚本在没有 sudo 访问权限的机器上运行,用
virtualenv..my 两美分做到这一点
标签: python matplotlib dependencies pip