尝试安装Python 2.x pip& MS Windows 7.0上的setuptools

时间:2018-02-10 13:47:26

标签: python windows powershell pip setuptools

我刚刚安装了Python 2.6.6 64位。我首先在Python命令行上遇到问题,因为编码错误,我认为我根据Windows command line encoding causes Python crash中提到的说明解决了它。 然后,在阅读了How to install Python pipPyPA pip installation manual中提供的说明后,我尝试使用管理员的Windows PowerShell安装pip。它失败了,我在shell中收到了这个:

    Exception:
Traceback (most recent call last):
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\commands\install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\req\req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\req\req_set.py", line 620, in _prepare_file
    session=self.session, hashes=hashes)
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\download.py", line 821, in unpack_url
    hashes=hashes
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\download.py", line 659, in unpack_http_url
    hashes)
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\download.py", line 882, in _download_http_url
    _download_url(resp, link, content_file, hashes)
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\download.py", line 603, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\utils\hashes.py", line 46, in check_against_chunks
    for chunk in chunks:
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\download.py", line 571, in written_chunks
    for chunk in chunks:
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\utils\ui.py", line 141, in iter
    self.next(n)
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\_vendor\progress\__init__.py", line 73, in next
    self.update()
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\_vendor\progress\bar.py", line 79, in update
    self.writeln(line)
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\_vendor\progress\helpers.py", line 68, in writeln
    print(line, end='', file=self.file)
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\_vendor\colorama\ansitowin32.py", line 141, in write
    self.write_and_convert(text)
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\_vendor\colorama\ansitowin32.py", line 169, in write_and_
convert
    self.write_plain_text(text, cursor, len(text))
  File "c:\users\u068\appdata\local\temp\tmpk0wofk\pip.zip\pip\_vendor\colorama\ansitowin32.py", line 174, in write_plai
n_text
    self.wrapped.write(text[start:end])
UnicodeEncodeError: 'ascii' codec can't encode character u'\u258e' in position 8: ordinal not in range(128)

然后我尝试在使用powershell读取相同的源和PyPA setuptools installation manual后安装setuptools easy_install。它再次失败,我收到了:

Exception calling "DownloadFile" with "2" argument(s): "The underlying connection was closed: An unexpected error occur
red on a send."
At line:1 char:152
+ [System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials; (new-object
System.Net.WebClient).DownloadFile <<<< ("https://pypi.io/packages/source/s/setuptools/setuptools-33.1.1.zip", "C:\setu
ptools-33.1.1.zip")
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

Traceback (most recent call last):
  File "ez_setup.py", line 414, in <module>
    sys.exit(main())
  File "ez_setup.py", line 410, in main
    archive = download_setuptools(**_download_args(options))
  File "ez_setup.py", line 355, in download_setuptools
    downloader(url, saveto)
  File "ez_setup.py", line 256, in download_file_powershell
    _clean_check(cmd, target)
  File "ez_setup.py", line 230, in _clean_check
    subprocess.check_call(cmd)
  File "c:\Python26\lib\subprocess.py", line 488, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['powershell', '-Command', '[System.Net.WebRequest]::DefaultWebProxy.Credentials
 = [System.Net.CredentialCache]::DefaultCredentials; (new-object System.Net.WebClient).DownloadFile("https://pypi.io/pac
kages/source/s/setuptools/setuptools-33.1.1.zip", "C:\\setuptools-33.1.1.zip")']' returned non-zero exit status 1

如何解决?

0 个答案:

没有答案