简体   繁体   English

无法在 windows 8 pc 上为 python 安装 PIP

[英]Unable to install PIP for python on windows 8 pc

I have python 3.2 on my pc and i want to be able to run the following: 'pip install requests' and 'pip install selenium'.我的电脑上有 python 3.2,我希望能够运行以下命令:“pip install requests”和“pip install selenium”。

To do this i know i need to install pip from here -> https://pip.pypa.io/en/stable/installing/为此,我知道我需要从这里安装 pip -> https://pip.pypa.io/en/stable/installing/

But when I click on the file python comes up and closes again right away and pip is not installed.但是当我点击文件时,python 出现并立即再次关闭并且没有安装 pip。

I tried running it through IDLE and get the following:我尝试通过 IDLE 运行它并获得以下信息:

> Traceback (most recent call last):
  File "C:\Users\Jarratt\Desktop\get-pip.py", line 17759, in <module>
    main()
  File "C:\Users\Jarratt\Desktop\get-pip.py", line 162, in main
    bootstrap(tmpdir=tmpdir)
  File "C:\Users\Jarratt\Desktop\get-pip.py", line 110, in bootstrap
    import setuptools  # noqa
  File "C:\Python32\lib\site-packages\setuptools-19.2-py3.2.egg\setuptools\__init__.py", line 12, in <module>
    from setuptools.extension import Extension
  File "C:\Python32\lib\site-packages\setuptools-19.2-py3.2.egg\setuptools\extension.py", line 8, in <module>
  File "C:\Python32\lib\site-packages\setuptools-19.2-py3.2.egg\setuptools\dist.py", line 19, in <module>
  File "C:\Python32\lib\site-packages\setuptools-19.2-py3.2.egg\pkg_resources\__init__.py", line 106, in <module>
    warnings.warn(msg)
  File "C:\Python32\lib\idlelib\PyShell.py", line 59, in idle_showwarning
    file.write(warnings.formatwarning(message, category, filename,
AttributeError: 'NoneType' object has no attribute 'write'
>>> 

在此处输入图像描述

You need to run it from the command line:您需要从命令行运行它:

  1. Download https://bootstrap.pypa.io/get-pip.py save somewhere so that you could find it like " C:\ ".下载https://bootstrap.pypa.io/get-pip.py保存在某个地方,这样你就可以像“ C:\ ”一样找到它。

  2. Open "Start Menu" and in execute type " cmd " and [Enter] , or search for " Standard " folder in " Start Menu " and open " Command line " there.打开“开始菜单”并在执行中键入“ cmd ”和[Enter] ,或在“ Start Menu ”中搜索“ Standard ”文件夹并在那里打开“ Command line ”。

  3. In command line type and execute " python C:\get-pip.py " or " python3 C:\get-pip.py ".在命令行中键入并执行“ python C:\get-pip.py ”或“ python3 C:\get-pip.py ”。

Usually works fine this way.通常以这种方式工作正常。

Looks like you are new to python, But pip.exe is a command and you have to run it from command line, or with run, or by manually clicking on it's icon.看起来你是 python 的新手,但是 pip.exe 是一个命令,你必须从命令行运行它,或者运行,或者手动单击它的图标。 You can use this code if you want to:如果您愿意,可以使用此代码:

>>> import os
>>> os.system("pip")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM