gpt4 book ai didi

python - pylab导入错误: No module named _thread

转载 作者:太空狗 更新时间:2023-10-29 21:29:51 24 4
gpt4 key购买 nike

从 ubuntu 10.04 开始,我使用 easy_install 安装了 pylab。升级后,我可以导入 pylab。首先,我运行从 easy_install 安装的 ipython:

$ ipython
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
Type "copyright", "credits" or "license" for more information.

IPython 0.11 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.

然后我尝试导入matplotlib

In [1]: import matplotlib

In [2]: matplotlib.__version__
Out[2]: '1.0.1'

但是导入pylab失败如下:

In [3]: import matplotlib.pylab
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/home/claire/<ipython-input-3-1d30b9aee20b> in <module>()
----> 1 import matplotlib.pylab

/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-i686.egg/matplotlib /pylab.py in <module>()
218 silent_list, iterable, dedent
219
--> 220 from matplotlib import mpl # pulls in most modules
221
222 from matplotlib.dates import date2num, num2date,\

/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-i686.egg/matplotlib /mpl.py in <module>()
1 from matplotlib import artist
2 from matplotlib import axis
----> 3 from matplotlib import axes
4 from matplotlib import cbook
5 from matplotlib import collections

/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-i686.egg/matplotlib /axes.py in <module>()
17 import matplotlib.colors as mcolors
18 import matplotlib.contour as mcontour
---> 19 import matplotlib.dates as mdates
20 from matplotlib import docstring
21 import matplotlib.font_manager as font_manager

/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-i686.egg/matplotlib/dates.py in <module>()
117 import matplotlib.ticker as ticker
118
--> 119 from dateutil.rrule import rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, \
120 MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY
121 from dateutil.relativedelta import relativedelta

/usr/local/lib/python2.6/dist-packages/python_dateutil-2.0-py2.6.egg/dateutil/rrule.py in <module>()
11 import datetime
12 import calendar
---> 13 import _thread
14 import sys
15

ImportError: No module named _thread

这可能是 python_dateutil 问题。我删除了与 synaptic 一起安装的旧版本 (1.4.3),但这并没有解决问题。

如何在不重新安装所有内容的情况下修复它?谢谢你。让-帕特里克

最佳答案

这是由 dateutil 引起的。

如您所见,您已经使用 easy_install 安装了 dateutil 2.0,但它与 python 2.x 不兼容。您应该卸载(或删除整个文件夹)2.0 版本,然后转到其 homepage并下载 1.5 版本,然后手动安装。

版本 2.0 适用于 Python 3.x,您也可以在主页上找到它。

--更新--

dateutil 2.1 已经出来了,现在不需要再使用 1.5,如果你能忍受 6 也安装 :)

关于python - pylab导入错误: No module named _thread,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8383056/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com