关于python:Pip错误:应升级pip,pandas和matplotlib但返回错误

Pip error:should upgrade pip, pandas and matplotlib but returns error

我必须卸载Python 3.6.1并安装3.5.0,因为这是唯一适用于TensorFlow的版本。 我正确地更改了路径,并且在成功安装第一个软件包(numpy)之后,出现了此错误(前两行)。 我试图按照它所说的做,并且发生错误(下),并且还尝试安装pandas和numpy(abowe):

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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
C:\\Users>pip3 install pandas matplotlib
Collecting pandas
  Using cached pandas-0.20.3.tar.gz
Collecting matplotlib
  Using cached matplotlib-2.0.2.tar.gz
    Complete output from command python setup.py egg_info:
============================================================================

Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
            matplotlib: yes [2.0.2]
                python: yes [3.5.0 (v3.5.0:374f501f4567, Sep 13 2015,
                        02:27:37) [MSC v.1900 64 bit (AMD64)]]
              platform: yes [win32]

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.13.1]
                   six: yes [using six version 1.10.0]
              dateutil: yes [using dateutil version 2.6.1]
           functools32: yes [Not required]
          subprocess32: yes [Not required]
                  pytz: yes [using pytz version 2017.2]
                cycler: yes [cycler was not found. pip will attempt to
                        install it after matplotlib.]
               tornado: yes [tornado was not found. It is required for the
                        WebAgg backend. pip/easy_install may attempt to
                        install it after matplotlib.]
             pyparsing: yes [pyparsing was not found. It is required for
                        mathtext support. pip/easy_install may attempt to
                        install it after matplotlib.]
                libagg: yes [pkg-config information for 'libagg' could not
                        be found. Using local copy.]
              freetype: no  [The C/C++ header for freetype (ft2build.h)
                        could not be found.  You may need to install the
                        development package.]
                   png: no  [The C/C++ header for png (png.h) could not be
                        found.  You may need to install the development
                        package.]
                 qhull: yes [pkg-config information for 'qhull' could not be

                        found. Using local copy.]

OPTIONAL SUBPACKAGES
           sample_data: yes [installing]
              toolkits: yes [installing]
                 tests: no  [skipping due to configuration]
        toolkits_tests: no  [skipping due to configuration]

OPTIONAL BACKEND EXTENSIONS
                macosx: no  [Mac OS-X only]
                qt5agg: no  [PyQt5 not found]
                qt4agg: no  [PySide not found; PyQt4 not found]
               gtk3agg: no  [Requires pygobject to be installed.]
             gtk3cairo: no  [Requires cairocffi or pycairo to be installed.]

                gtkagg: no  [Requires pygtk]
                 tkagg: yes [installing; run-time loading from Python Tcl /
                        Tk]
                 wxagg: no  [requires wxPython]
                   gtk: no  [Requires pygtk]
                   agg: yes [installing]
                 cairo: no  [cairocffi or pycairo not found]
             windowing: yes [installing]

OPTIONAL LATEX DEPENDENCIES
                dvipng: no
           ghostscript: no
                 latex: no
               pdftops: no

OPTIONAL PACKAGE DATA
                  dlls: no  [skipping due to configuration]

============================================================================

                        * The following required packages can not be built:
                        * freetype, png

----------------------------------------
Command"python setup.py egg_info" failed with error code 1 in
C:\\Users\\Ap
pData\\Local\\Temp\\pip-build-qdqqojgq\\matplotlib

更新点数:

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
C:\\windows\\system32>python -m pip install --upgrade pip
Collecting pip
Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 7.1.2
Exception:
Traceback (most recent call last):
File"C:\\Users\\AppData\\Local\\Programs\\Python\\Python35\\lib\\site-
packages\\p
ip\\basecommand.py"
, line 211, in main
status = self.run(options, args)
File"C:\\Users\\AppData\\Local\\Programs\\Python\\Python35\\lib\\site-
packages\\p
ip\\commands\\install.py"
, line 311, in run
root=options.root_path,
File"C:\\Users\\AppData\\Local\\Programs\\Python\\Python35\\lib\\site-
packages\\p
ip\
eq\
eq_set.py"
, line 640, in install
requirement.uninstall(auto_confirm=True)
File"C:\\Users\\AppData\\Local\\Programs\\Python\\Python35\\lib\\site-
packages\\p
ip\
eq\
eq_install.py"
, line 673, in uninstall
for path in pip.wheel.uninstallation_paths(dist):
File"C:\\Users\\AppData\\Local\\Programs\\Python\\Python35\\lib\\site-
packages\\p
ip\\wheel.py"
, line 512, in unique
for item in fn(*args, **kw):
File"C:\\Users\\AppData\\Local\\Programs\\Python\\Python35\\lib\\site-
packages\\p
ip\\wheel.py"
, line 531, in uninstallation_paths
r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
File"C:\\Users\\Uro?\\AppData\\Local\\Programs\\Python\\Python35\\lib\\site-
packages\\p
ip\\_vendor\\pkg_resources\\__init__.py"
, line 1619, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File"C:\\Users\\AppData\\Local\\Programs\\Python\\Python35\\lib\\site-
packages\\p
ip\\_vendor\\pkg_resources\\__init__.py"
, line 1616, in get_metadata
return self._get(self._fn(self.egg_info, name)).decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9a in position 22368:
inva
lid start byte
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the '
python -m pip install --upgrade pip'
comm
and.

我尝试下载轮,然后安装它:

1
2
3
C:\\Users\\Downloads>pip install matplotlib-2.0.2-cp36-cp36m-win32.whl
matplotlib-2.0.2-cp36-cp36m-win32.whl is not a supported wheel on this
platform.

也尝试了64 bt版本,相同的故事。

有什么想法该做什么,这甚至意味着什么?


请尝试:pip3 install pandas matplotlib,不带逗号。我相信错误是,如果您有空格以外的其他东西,pip正在寻找特定版本。

看到:
如何使用pip一次安装多个python软件包


从此站点下载所需的所有模块http://www.lfd.uci.edu/~gohlke/pythonlibs/
只需下载whl文件,然后在文件所在的文件夹中pip安装filename.whl。希望这对您有所帮助。


这个问题已经成为一个新问题,因此需要一个新的答案。解决了逗号问题后,您的系统开始大吼大叫,因为matplotlib依赖于pip如果不将源代码编译为二进制(即freetype和png)就无法安装的软件包。从理论上讲,您可以设置一个编译器并全力以赴,但这对我们大多数人来说都是一个真正的痛苦。

问题的答案是完全清除python安装并重新开始。这次,安装Anaconda python发行版,而不是pip安装matplotlib,而是使用conda安装matplotlib。实际上,如果您安装了完整的Anaconda发行版,则matplotlib将已经存在。

Anaconda的优点在于,它们可以跟踪大量预编译的软件包,因此您不必担心像在pip中那样构建所有这些东西。

如果您不想这样做,并希望保留当前的python设置,则可以从Christopher Gholke网站下载所有轮子,然后使用pip安装轮子。这些软件包包含您需要的编译二进制文件,这些二进制文件无法直接从PyPI获得


按键盘上的Windows按钮。
键入cmd并按Ctrl + Shift + Enter以管理员身份启动命令提示符

输入:

1
python -m pip install --upgrade pip

然后安装所需的内容:

1
pip install pandas matplotlib

请注意,程序包名称不以逗号分隔,而仅以空格分隔