首先

安装 python

然后

在安装 pip

最后 

在 cmd 下执行以下命令报错

pip install qrcode

pip install pillow

cmd 执行pip install qrcode 命令报错困扰我了 几个月,

报错如下:

C:\Users\cby>pip install qrcode
Downloading/unpacking qrcode
  Downloading qrcode-6.1-py2.py3-none-any.whl
Cleaning up...
Exception:
Traceback (most recent call last):
  File "C:\install\python3.4\lib\site-packages\pip\_vendor\pkg_resources.py", line 2421, in _dep_map
    return self.__dep_map
  File "C:\install\python3.4\lib\site-packages\pip\_vendor\pkg_resources.py", line 2283, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\install\python3.4\lib\site-packages\pip\basecommand.py", line 122, in main
    status = self.run(options, args)
  File "C:\install\python3.4\lib\site-packages\pip\commands\install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "C:\install\python3.4\lib\site-packages\pip\req.py", line 1265, in prepare_files
    req_to_install.extras):
  File "C:\install\python3.4\lib\site-packages\pip\_vendor\pkg_resources.py", line 2232, in requires
    dm = self._dep_map
  File "C:\install\python3.4\lib\site-packages\pip\_vendor\pkg_resources.py", line 2423, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "C:\install\python3.4\lib\site-packages\pip\_vendor\pkg_resources.py", line 2456, in _compute_dependencies
    common = frozenset(reqs_for_extra(None))
  File "C:\install\python3.4\lib\site-packages\pip\_vendor\pkg_resources.py", line 2453, in reqs_for_extra
    if req.marker_fn(override={'extra':extra}):
  File "C:\install\python3.4\lib\site-packages\pip\_vendor\_markerlib\markers.py", line 113, in marker_fn
    return eval(compiled_marker, environment)
  File "<environment marker>", line 1, in <module>
NameError: name 'platform_system' is not defined

Storing debug log for failure in C:\Users\cby\pip\pip.log

解决办法

更新 pip 

python -m pip install --upgrade pip


Downloading/unpacking pip from https://files.pythonhosted.org/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e675a1/pip-19.2.3-py2.py3-none-any.whl#sha256=340a0ba40fdeb16413914c0fcd8e0b4ebb0bf39a900ec80e11c05d836c05103f
Installing collected packages: pip
  Found existing installation: pip 1.5.4
    Uninstalling pip:
      Successfully uninstalled pip
Successfully installed pip
Cleaning up...

再进行安装 qrcode 安装成功了。

执行安装命令 pip install pillow 时候报错 ,修改命令 pip install Pillow 执行 成功。

 

为什么安装的不是PIL呢?PIL模块只支持python2.7及以下版本,python3之后无法使用,官方推荐python3.x使用Pillow代替PIL模块,实际上Pillow的与PIL完全兼容,部分功能还得到完善。
如果不想使用pip安装,或者想单独下载离线安装,请登陆python官网PyPI栏目,搜索pillow,并选择最新版本。
 

参考 https://pypi.org/project/Pillow/3.2.0/#files

 

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐