首页 > 解决方案 > 尝试在 Python 中安装 pydot 时出错

问题描述

今天是我学习机器学习的第一天,我正在使用 Anaconda

我想使用 pydot 来可视化数据

我试过这个来安装pydot

pip install pydot

但收到此错误

Collecting pydot
  Downloading https://files.pythonhosted.org/packages/c3/f1/e61d6dfe6c1768ed2529761a68f70939e2569da043e9f15a8d84bf56cadf/pydot-1.2.4.tar.gz (132kB)
    100% |████████████████████████████████| 133kB 2.6MB/s
Requirement already satisfied: pyparsing>=2.1.4 in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from pydot)
Building wheels for collected packages: pydot
  Running setup.py bdist_wheel for pydot ... done
  Stored in directory: C:\Users\ASMGX\AppData\Local\pip\Cache\wheels\6a\a5\14\25541ebcdeaf97a37b6d05c7ff15f5bd20f5e91b99d313e5b4
Successfully built pydot
Installing collected packages: pydot
Exception:
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\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)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pip\wheel.py", line 323, in clobber
    shutil.copyfile(srcfile, destfile)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Anaconda3_64\\Lib\\site-packages\\dot_parser.py'
You are using pip version 9.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

我进一步搜索并得到了这个脚本

conda install -c https://conda.binstar.org/sstromberg pydot

但得到另一个错误

Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.4.10
  latest version: 4.5.10

Please update conda by running

    $ conda update -n base conda



## Package Plan ##

  environment location: C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64

  added / updated specs:
    - pydot


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    pydot-1.2.4                |           py36_0          38 KB

The following NEW packages will be INSTALLED:

    pydot: 1.2.4-py36_0

Proceed ([y]/n)?


Downloading and Extracting Packages
pydot 1.2.4: ################################################################################################################################################## | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: failed
ERROR conda.core.link:_execute(481): An error occurred while installing package 'defaults::pydot-1.2.4-py36_0'.
PermissionError(13, 'Access is denied')
Attempting to roll back.

Rolling back transaction: done

PermissionError(13, 'Access is denied')

需要什么样的许可以及如何解决?

谁能帮我安装pydot?

标签: pythonanacondapydot

解决方案


以管理员权限再次运行


推荐阅读