使用 pip 为 python (3.6) 安装 XLRD 时出错

Error when installing XLRD using pip for python (3.6)

我正在使用 windows 10 64 位,我使用 python 安装程序安装了 pip 和 python。当我键入命令 pip install xlrd 时出现以下错误:

C:\Users\Tanmay>pip install xlrd
Collecting xlrd
  Downloading xlrd-1.0.0-py3-none-any.whl (143kB)
    100% |████████████████████████████████| 153kB 317kB/s
Installing collected packages: xlrd
Exception:
Traceback (most recent call last):
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\utils\__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "c:\program files (x86)\python36-32\lib\os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [WinError 5] Access is denied: 'c:\program files (x86)\python36-32\Lib\site-packages\xlrd'

它给你权限错误尝试安装它 作为超级用户 sudo pip install xlrd

在 windows 的情况下,在 cmd 中尝试使用 python 可执行文件

运行 pip 安装

例如

`python -m pip install xlrd`

以管理员身份通过 运行 命令提示符简单地解决了这个问题。