Pip error:should upgrade pip, pandas and matplotli

2019-08-16 18:57发布

I had to uninstall Python 3.6.1 and install 3.5.0 because this is the only version suitable for TensorFlow. I changed my path correctly and after I installed first package (numpy) successfuly this error came up (first two lines). I tried to do as it said and error occurred(below) and also tried to install pandas and numpy(abowe):

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

Updating pip:

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\req\req_set.py", line 640, in install
requirement.uninstall(auto_confirm=True)
File "C:\Users\AppData\Local\Programs\Python\Python35\lib\site-
packages\p
ip\req\req_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.

I tried to download wheel and then install it:

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.

Tried also with 64 bt version, same story.

Any ideas what to do, what does it even mean?

4条回答
唯我独甜
2楼-- · 2019-08-16 19:07

This question has become a new question and thus requires a new answer. After fixing your comma problem your system started yelling at you because matplotlib depends on packages that pip cannot install without compiling source code to binary, namely freetype and png. In theory you could setup a compiler and work this all out but that is a real pain for most of us.

The answer to your problems is to completely wipe your python installs and start over. This time, install the Anaconda python distribution, and instead of pip install matplotlib, use conda install matplotlib. Actually if you install the full Anaconda distribution, matplotlib will already be there.

The beauty of Anaconda is that they keep track of large collection of precompiled packages so you don't have to worry about building all this stuff the way you do in pip.

If you don't want to do that and want to keep your current python setup, you can download all the wheels from the Christopher Gholke website and use pip to install the wheels. These packages contain the compiled binaries you need that are not available directly from the PyPI

查看更多
仙女界的扛把子
3楼-- · 2019-08-16 19:09

try: pip3 install pandas matplotlib without the comma. I believe that the error is that if you have something other than a space, pip is looking for a specific version.

see: How to install multiple python packages at once using pip

查看更多
Luminary・发光体
4楼-- · 2019-08-16 19:11

Download all the modules that you need from this site http://www.lfd.uci.edu/~gohlke/pythonlibs/ Just download whl file and do pip install filename.whl in the folder where the file is. Hope this helped you.

查看更多
The star\"
5楼-- · 2019-08-16 19:25

Press windows button on your keyboard. Type cmd and press Ctrl+Shift+Enter to start command prompt as admin

Type in:

python -m pip install --upgrade pip

Then to install what you want type:

pip install pandas matplotlib

note that the package names are not separated by comma but simply by space

查看更多
登录 后发表回答