关于python:Matplotlib在导入时会询问用户名

Matplotlib asks username when imported

我正试图修复这个问题,但我不明白为什么它要求我输入"用户名"和"用户ID"。

1
2
3
4
5
What user name
username:

What is the user id
Enter user id:

有人能毫无问题地运行它吗?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env python

import numpy as np
import matplotlib.pyplot as plt

N = 5

mMeans = (20, 35, 30, 35, 27)
wMeans = (25, 32, 34, 20, 25)
ind = np.arange(N)
width = 0.5

plt.bar(ind, mMeans, width)
plt.bar(ind, wMeans, width, bottom=mMeans)
plt.show()

这是我中止运行时出现的内容(ctrl+c):

1
2
3
4
$ python stack.py

    What username
    username:

这是我停止命令的地方。

1
2
3
^CTraceback (most recent call last):
          File"stack.py", line 5, in <module>
            import matplotlib.pyplot as plt

What appears including using IDLE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
What user name

username: ^CTraceback (most recent call last):

  File"stack.py", line 4, in

    from matplotlib import pyplot as plt #.pyplot as plt

  File"/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 36, in

    from matplotlib.backend_bases import FigureCanvasBase

  File"/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 70, in

    from PIL import Image

  File"/usr/lib/python2.7/dist-packages/PIL/Image.py", line 107, in
    import builtins

  File"/usr/local/lib/python2.7/dist-packages/builtins/__init__.py", line 8, in

    from future.builtins import *

  File"/usr/local/lib/python2.7/dist-packages/future/builtins/__init__.py", line 10, in

    from future.builtins.iterators import (filter, map, zip)

  File"/usr/local/lib/python2.7/dist-packages/future/builtins/iterators.py", line 43, in

    from future.types import newrange as range

  File"/usr/local/lib/python2.7/dist-packages/future/types/__init__.py", line 243, in

    from .newrange import newrange

  File"/usr/local/lib/python2.7/dist-packages/future/types/newrange.py", line 25, in

    from future.backports.misc import count   # with step parameter on Py2.6
  File"/usr/local/lib/python2.7/dist-packages/future/backports/__init__.py", line 17, in

    from .misc import (ceil,

  File"/usr/local/lib/python2.7/dist-packages/future/backports/misc.py", line 17, in

    import subprocess

  File"/home/flira/Downloads/subprocess.py", line 6, in

    username = str(raw_input('username: '))

KeyboardInterrupt


您的PYTHONPATH中有一个错误/个人版本的subprocess

1
username = str(raw_input('username: '))

在我熟悉的subprocess.py的任何python发行版中都不存在。删除/重命名该文件,或者删除

1
/home/flira/Downloads/

从你的PYTHONPATH中。安装任何库的方法都是通过apt-get,而不是手动下载(如果您不确定自己在做什么)。

进一步调查

我现在注意到你的终端截图——你正在下载,所以文件就在你的路径上。摆脱它。