I'm having a hard time setting up python packages. EasyInstall from SetupTools is supposed to help that, but they don't have an executable for Python 2.6.
我很难设置python包。来自SetupTools的EasyInstall应该会有所帮助,但是它们没有Python 2.6的可执行文件。
For instance to install Mechanize, I'm just supposed to put the Mechanize folder in C:\Python24\Lib\site-packages according to INSTALL.txt, but runnning the tests does not work. Can someone help shed some light on this? Thanks!
例如,为了安装机械化,我应该把机械化文件夹放在C:\Python24\Lib\site-package根据安装。txt,但运行测试不工作。有人能帮我解释一下吗?谢谢!
10 个解决方案
#1
149
The accepted answer is outdated. So first, pip
is preferred over easy_install
, (Why use pip over easy_install?). Then follow these steps to install pip
on Windows, it's quite easy.
公认的答案已经过时了。首先,pip优于easy_install(为什么要使用pip而不是easy_install?)。然后按照这些步骤在Windows上安装pip,这很简单。
-
Install
setuptools
:安装setuptools:
curl https://bootstrap.pypa.io/ez_setup.py | python
-
Install
pip
:pip安装:
curl https://bootstrap.pypa.io/get-pip.py | python
-
Optionally, you can add the path to your environment so that you can use
pip
anywhere. It's somewhere likeC:\Python33\Scripts
.您还可以选择添加路径到您的环境,以便您可以在任何地方使用pip。某个地方像C:\ Python33 \脚本。
#2
70
Newer versions of Python for Windows come with the pip package manager. (source)
新版本的Python与pip包管理器一起使用。(源)
pip is already installed if you're using Python 2 >=2.7.9 or Python 3 >=3.4
如果您使用的是Python 2 >=2.7.9或Python 3 >=3.4,那么pip就已经安装了。
Use that to install packages:
使用它来安装包:
cd C:\Python\Scripts\
pip.exe install <package-name>
So in your case it'd be:
所以在你的案例中
pip.exe install mechanize
#3
52
This is a good tutorial on how to get easy_install
on windows. The short answer: add C:\Python26\Scripts
(or whatever python you have installed) to your PATH.
这是一个关于如何在windows上获得easy_install的好教程。简单的答案是:添加C:\Python26\脚本(或者您安装的任何python)到您的路径。
#4
21
You don't need the executable for setuptools. You can download the source code, unpack it, traverse to the downloaded directory and run python setup.py install
in the command prompt
您不需要setuptools的可执行文件。您可以下载源代码,解压它,遍历下载的目录并运行python设置。py安装在命令提示符中。
#5
11
As I wrote elsewhere
就像我写在其他地方
Packaging in Python is dire. The root cause is that the language ships without a package manager.
在Python中打包是可怕的。根本原因是没有包管理器的语言船只。
Fortunately, there is one package manager for Python, called Pip. Pip is inspired by Ruby's Gem, but lacks some features. Ironically, Pip itself is complicated to install. Installation on the popular 64-bit Windows demands building and installing two packages from source. This is a big ask for anyone new to programming.
幸运的是,有一个Python的包管理器,叫做Pip。Pip的灵感来自Ruby的Gem,但是缺少一些特性。具有讽刺意味的是,Pip本身安装起来很复杂。安装在流行的64位Windows上,需要从源代码构建和安装两个包。这是一个很大的要求,对于任何新的编程。
So the right thing to do is to install pip. However if you can't be bothered, Christoph Gohlke provides binaries for popular Python packages for all Windows platforms http://www.lfd.uci.edu/~gohlke/pythonlibs/
所以正确的做法是安装pip。不过,如果您不介意的话,Christoph Gohlke为所有Windows平台的流行Python包提供了二进制文件。
In fact, building some Python packages requires a C compiler (eg. mingw32) and library headers for the dependencies. This can be a nightmare on Windows, so remember the name Christoph Gohlke.
事实上,构建一些Python包需要一个C编译器(如。和库标题的依赖关系。这可能是Windows的噩梦,所以请记住Christoph Gohlke的名字。
#6
9
Starting with Python 2.7, pip is included by default. Simply download your desired package via
从Python 2.7开始,默认情况下包括pip。只需下载您想要的包。
python -m pip install [package-name]
#7
3
I had problems in installing packages on Windows. Found the solution. It works in Windows7+. Mainly anything with Windows Powershell should be able to make it work. This can help you get started with it.
我在Windows上安装软件包时有问题。找到了解决方案。它在Windows7多+工作。任何有Windows Powershell的东西都应该能够让它正常工作。这可以帮助你开始。
- Firstly, you'll need to add python installation to your PATH variable. This should help.
- 首先,您需要将python安装添加到PATH变量中。这应该帮助。
- You need to download the package in zip format that you are trying to install and unzip it. If it is some odd zip format use 7Zip and it should be extracted.
- 您需要下载zip格式的包,您正在尝试安装和解压它。如果是一些奇怪的zip格式,请使用7Zip,并且应该提取它。
- Navigate to the directory extracted with setup.py using Windows Powershell (Use link for it if you have problems)
- 导航到通过设置提取的目录。py使用Windows Powershell(如果有问题,请使用链接)
- Run the command
python setup.py install
- 运行命令python设置。py安装
That worked for me when nothing else was making any sense. I use Python 2.7 but the documentation suggests that same would work for Python 3.x also.
这对我来说是毫无意义的。我使用的是Python 2.7,但文档表明同样适用于Python 3。x。
#8
0
You can also just download and run ez_setup.py, though the SetupTools documentation no longer suggests this. Worked fine for me as recently as 2 weeks ago.
您也可以下载并运行ez_setup。py,尽管SetupTools文档不再说明这一点。就在两周前,我的工作还不错。
#9
0
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
Or just put the directory to your pip executable in your system path.
或者只是将目录放到系统路径中的pip可执行文件中。
#10
0
As mentioned by Blauhirn after 2.7 pip is preinstalled. If it is not working for you it might need to be added to path.
正如Blauhirn所提到的,2.7 pip是预装的。如果它不为您工作,它可能需要添加到路径。
However if you run Windows 10 you no longer have to open a terminal to install a module. The same goes for opening Python as well.
但是,如果运行Windows 10,则不必再打开一个终端来安装模块。打开Python也是如此。
You can type directly into the search menu pip install mechanize
, select command and it will install:
您可以直接键入搜索菜单pip安装机械化,选择命令,它将安装:
If anything goes wrong however it may close before you can read the error but still it's a useful shortcut.
如果有什么问题,在你读到错误之前它可能会关闭,但它仍然是一个有用的捷径。
#1
149
The accepted answer is outdated. So first, pip
is preferred over easy_install
, (Why use pip over easy_install?). Then follow these steps to install pip
on Windows, it's quite easy.
公认的答案已经过时了。首先,pip优于easy_install(为什么要使用pip而不是easy_install?)。然后按照这些步骤在Windows上安装pip,这很简单。
-
Install
setuptools
:安装setuptools:
curl https://bootstrap.pypa.io/ez_setup.py | python
-
Install
pip
:pip安装:
curl https://bootstrap.pypa.io/get-pip.py | python
-
Optionally, you can add the path to your environment so that you can use
pip
anywhere. It's somewhere likeC:\Python33\Scripts
.您还可以选择添加路径到您的环境,以便您可以在任何地方使用pip。某个地方像C:\ Python33 \脚本。
#2
70
Newer versions of Python for Windows come with the pip package manager. (source)
新版本的Python与pip包管理器一起使用。(源)
pip is already installed if you're using Python 2 >=2.7.9 or Python 3 >=3.4
如果您使用的是Python 2 >=2.7.9或Python 3 >=3.4,那么pip就已经安装了。
Use that to install packages:
使用它来安装包:
cd C:\Python\Scripts\
pip.exe install <package-name>
So in your case it'd be:
所以在你的案例中
pip.exe install mechanize
#3
52
This is a good tutorial on how to get easy_install
on windows. The short answer: add C:\Python26\Scripts
(or whatever python you have installed) to your PATH.
这是一个关于如何在windows上获得easy_install的好教程。简单的答案是:添加C:\Python26\脚本(或者您安装的任何python)到您的路径。
#4
21
You don't need the executable for setuptools. You can download the source code, unpack it, traverse to the downloaded directory and run python setup.py install
in the command prompt
您不需要setuptools的可执行文件。您可以下载源代码,解压它,遍历下载的目录并运行python设置。py安装在命令提示符中。
#5
11
As I wrote elsewhere
就像我写在其他地方
Packaging in Python is dire. The root cause is that the language ships without a package manager.
在Python中打包是可怕的。根本原因是没有包管理器的语言船只。
Fortunately, there is one package manager for Python, called Pip. Pip is inspired by Ruby's Gem, but lacks some features. Ironically, Pip itself is complicated to install. Installation on the popular 64-bit Windows demands building and installing two packages from source. This is a big ask for anyone new to programming.
幸运的是,有一个Python的包管理器,叫做Pip。Pip的灵感来自Ruby的Gem,但是缺少一些特性。具有讽刺意味的是,Pip本身安装起来很复杂。安装在流行的64位Windows上,需要从源代码构建和安装两个包。这是一个很大的要求,对于任何新的编程。
So the right thing to do is to install pip. However if you can't be bothered, Christoph Gohlke provides binaries for popular Python packages for all Windows platforms http://www.lfd.uci.edu/~gohlke/pythonlibs/
所以正确的做法是安装pip。不过,如果您不介意的话,Christoph Gohlke为所有Windows平台的流行Python包提供了二进制文件。
In fact, building some Python packages requires a C compiler (eg. mingw32) and library headers for the dependencies. This can be a nightmare on Windows, so remember the name Christoph Gohlke.
事实上,构建一些Python包需要一个C编译器(如。和库标题的依赖关系。这可能是Windows的噩梦,所以请记住Christoph Gohlke的名字。
#6
9
Starting with Python 2.7, pip is included by default. Simply download your desired package via
从Python 2.7开始,默认情况下包括pip。只需下载您想要的包。
python -m pip install [package-name]
#7
3
I had problems in installing packages on Windows. Found the solution. It works in Windows7+. Mainly anything with Windows Powershell should be able to make it work. This can help you get started with it.
我在Windows上安装软件包时有问题。找到了解决方案。它在Windows7多+工作。任何有Windows Powershell的东西都应该能够让它正常工作。这可以帮助你开始。
- Firstly, you'll need to add python installation to your PATH variable. This should help.
- 首先,您需要将python安装添加到PATH变量中。这应该帮助。
- You need to download the package in zip format that you are trying to install and unzip it. If it is some odd zip format use 7Zip and it should be extracted.
- 您需要下载zip格式的包,您正在尝试安装和解压它。如果是一些奇怪的zip格式,请使用7Zip,并且应该提取它。
- Navigate to the directory extracted with setup.py using Windows Powershell (Use link for it if you have problems)
- 导航到通过设置提取的目录。py使用Windows Powershell(如果有问题,请使用链接)
- Run the command
python setup.py install
- 运行命令python设置。py安装
That worked for me when nothing else was making any sense. I use Python 2.7 but the documentation suggests that same would work for Python 3.x also.
这对我来说是毫无意义的。我使用的是Python 2.7,但文档表明同样适用于Python 3。x。
#8
0
You can also just download and run ez_setup.py, though the SetupTools documentation no longer suggests this. Worked fine for me as recently as 2 weeks ago.
您也可以下载并运行ez_setup。py,尽管SetupTools文档不再说明这一点。就在两周前,我的工作还不错。
#9
0
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
Or just put the directory to your pip executable in your system path.
或者只是将目录放到系统路径中的pip可执行文件中。
#10
0
As mentioned by Blauhirn after 2.7 pip is preinstalled. If it is not working for you it might need to be added to path.
正如Blauhirn所提到的,2.7 pip是预装的。如果它不为您工作,它可能需要添加到路径。
However if you run Windows 10 you no longer have to open a terminal to install a module. The same goes for opening Python as well.
但是,如果运行Windows 10,则不必再打开一个终端来安装模块。打开Python也是如此。
You can type directly into the search menu pip install mechanize
, select command and it will install:
您可以直接键入搜索菜单pip安装机械化,选择命令,它将安装:
If anything goes wrong however it may close before you can read the error but still it's a useful shortcut.
如果有什么问题,在你读到错误之前它可能会关闭,但它仍然是一个有用的捷径。