如何在Windows上安装Python包?如何在Windows上安装Python包?(How do

2019-05-04 05:16发布

我有一个很难建立Python包。 从EasyInstall setuptools的是应该帮助的是,但他们没有一个可执行的Python 2.6。

例如安装机械化,我只是应该把机械化文件夹C:根据INSTALL.TXT \ Python24 \ LIB \站点包,但捉迷藏的测试不起作用。 有人可以帮助阐明这一些轻? 谢谢!

Answer 1:

该接受的答案是过时的。 因此,首先, pip优于easy_install ,( 为什么要使用PIP过的easy_install? )。 然后按照下列步骤来安装pip在Windows上,它很容易。

  1. 安装setuptools

     curl https://bootstrap.pypa.io/ez_setup.py | python 
  2. 安装pip

     curl https://bootstrap.pypa.io/get-pip.py | python 
  3. 您可以选择的路径添加到您的环境,使您可以使用pip任何地方。 它的地方,比如C:\Python33\Scripts



Answer 2:

对于Windows新版本的Python来与PIP包管理器。 (资源)

如果你正在使用Python 2> = 2.7.9或Python 3> = 3.4 PIP已安装

用它来安装软件包:

cd C:\Python\Scripts\
pip.exe install <package-name>

所以你的情况这会是:

pip.exe install mechanize


Answer 3:

这是一个关于如何得到一个很好的教程easy_install Windows上。 答案很简单:添加C:\Python26\Scripts (或任何蟒蛇已安装)到PATH。



Answer 4:

你并不需要setuptools的可执行文件。 您可以下载源代码,解压缩,运行到下载目录并运行python setup.py install在命令提示符



Answer 5:

与Python 2.7开始,PIP默认情况下包括在内。 只需下载你想要的包通过

python -m pip install [package-name]


Answer 6:

正如我写的其他地方

包装在Python是可怕的。 根本原因在于语言没有船只的软件包管理器。

幸运的是,Python的一个包管理器,叫皮普 。 皮普是Ruby的宝石启发,但缺少一些功能。 讽刺的是,皮普本身是复杂的安装 。 上流行的64位Windows安装需要构建和从源代码安装这两个包。 这是一个很大的要求,任何人新的节目。


所以,做正确的事情是安装点子。 但是,如果你不能打扰,克里斯托夫Gohlke提供了流行的Python包二进制文件的所有Windows平台http://www.lfd.uci.edu/~gohlke/pythonlibs/

事实上,建设一些Python包需要C编译器(如mingw32的)和依赖库头。 这可以是Windows上的噩梦,所以记住了这个名字克里斯托夫Gohlke。



Answer 7:

我在Windows上安装软件包问题。 找到了解决办法。 它的工作原理在Windows7 +。 主要是使用Windows PowerShell什么应该能够使它发挥作用。 这可以帮助您开始使用它。

  • 首先,你需要Python安装添加到您的PATH变量。 这应该帮助。
  • 你需要下载软件包中的zip格式,你要安装并解压缩。 如果是一些奇怪的zip格式使用7Zip的,它应该被提取。
  • 导航到使用Windows PowerShell(使用链接,如果你有问题)setup.py解压的目录
  • 运行命令python setup.py install

这为我工作的时候没有别的作出任何意义。 我使用Python 2.7,但文件表明,同样会为Python 3.x的工作也。



Answer 8:

你也可以下载并运行ez_setup.py,虽然setuptools的文档不再显示此。 工作得很好,我最近在2个星期前。



Answer 9:

PS D:\simcut>  C:\Python27\Scripts\pip.exe install networkx
Collecting networkx
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:318: SNIMissingWarning: An HTTPS reques
t has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may caus
e the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer ve
rsion of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissi
ngwarning.
  SNIMissingWarning
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SS
LContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL con
nections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.
readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading networkx-1.11-py2.py3-none-any.whl (1.3MB)
    100% |################################| 1.3MB 664kB/s
Collecting decorator>=3.4.0 (from networkx)
  Downloading decorator-4.0.11-py2.py3-none-any.whl
Installing collected packages: decorator, networkx
Successfully installed decorator-4.0.11 networkx-1.11
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SSLContext object i
s not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade
to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplat
formwarning.
  InsecurePlatformWarning

或者只是把目录画中画可执行在你的系统路径。



Answer 10:

正如Blauhirn提到后,在2.7个点预装。 如果它不为你工作,可能需要被添加到路径。

不过,如果你运行Windows 10,你不再需要打开一个终端安装模块。 这同样适用于开放的Python以及。

您可以直接输入到搜索菜单pip install mechanize ,选择命令,它会安装:

如果有错误但它可能会关闭之前,你可以读取错误,但仍然是一个有用的快捷方式。



文章来源: How do I install Python packages on Windows?
标签: python pip