无法在Windows 10中安装软件包 [英] Can't install packages in Windows 10

查看:100
本文介绍了无法在Windows 10中安装软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚重新安装了Python 3.6,但是当我尝试安装软件包时,Windows返回错误.首先,我尝试从Windows命令提示符安装软件包BeautifulSoup:

I just reinstalled Python 3.6, but when I try to install packages, Windows returns errors. First I tried installing package BeautifulSoup from the Windows command prompt:

python -m pip install BeautifulSoup

但这会返回以下错误:

Collecting BeautifulSoup
  Using cached BeautifulSoup-3.2.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Robert\AppData\Local\Temp\pip-build-iiyyxs2o\BeautifulSoup\setup.py", line 22
        print "Unit tests have failed!"
                                      ^
    SyntaxError: Missing parentheses in call to 'print'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Robert\AppData\Local\Temp\pip-build-iiyyxs2o\BeautifulSoup\

然后我尝试安装软件包requests:

Then I tried installing package requests:

python -m pip install requests

但这会返回

C:\Program Files\Python36>python -m pip install requests
Collecting requests
  Using cached requests-2.18.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests)
  Using cached certifi-2017.7.27.1-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests)
  Using cached idna-2.6-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests)
  Using cached chardet-3.0.4-py2.py3-none-any.whl
Collecting urllib3<1.23,>=1.21.1 (from requests)
  Using cached urllib3-1.22-py2.py3-none-any.whl
Installing collected packages: certifi, idna, chardet, urllib3, requests
Exception:
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Program Files\Python36\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "C:\Program Files\Python36\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "C:\Program Files\Python36\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\Python36\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "C:\Program Files\Python36\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "C:\Program Files\Python36\lib\site-packages\pip\wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "C:\Program Files\Python36\lib\site-packages\pip\utils\__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "C:\Program Files\Python36\lib\os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [WinError 5] Access is denied: 'C:\\Program Files\\Python36\\Lib\\site-packages\\certifi'

我需要做什么才能使pip成功安装软件包?

What do I need to do so that pip successfully installs packages?

推荐答案

BeautifulSoup仅适用于Python 2.对于Python 3,安装 beautifulsoup4 :

BeautifulSoup is for Python 2 only. For Python 3 install beautifulsoup4:

pip install beautifulsoup4

第二个问题似乎很明显:您没有对C:\\Program Files\\Python36\\Lib\\site-packages和子目录的写访问权.

The second problem seems obvious: you don't have write-access to C:\\Program Files\\Python36\\Lib\\site-packages and subdirectories.

这篇关于无法在Windows 10中安装软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆