如何在 Windows 上安装 .egg Python 包(尝试使用 easy_install 不起作用)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18558733/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 11:05:56  来源:igfitidea点击:

How can I install a .egg Python package on Windows (attempt using easy_install not working)

pythonpython-2.7packagesqstk

提问by ChrisProsser

I am trying to install a package named QSTK for a course that I am doing. The course points to an installation package for the 32 bit version, but I have 64 Python installed. I have found a .egg file listed on the Python packages index.

我正在尝试为我正在做的课程安装一个名为 QSTK 的包。课程指向32位版本的安装包,但我安装了64位Python。我在Python 包索引中找到了一个 .egg 文件。

It seems to have an exe for 32 bit, but just the .egg for 64 bit. I downloaded the QSTK-0.2.6-py2.7.egg version and have been trying to install this unsucessfully so far.

它似乎有一个 32 位的 exe,但只有 64 位的 .egg。我下载了 QSTK-0.2.6-py2.7.egg 版本,到目前为止一直在尝试安装它,但没有成功。

Here is what I have tried:

这是我尝试过的:

  1. Using easy install (from the C:\Python27\Lib\site-packages directory):

    Python easy_install -Z C:\Users\Prosserc\Downloads\QSTK-0.2.6-py2.7.egg
    

    this has created a QSTK-0.2.6-py2.7.egg directory in my site-packages directory which I can open and find files in. However, I have tried to import QSTK from the python shell and get the usual "No module named..." import error.

  2. I looked for a setup.py file as I have used these to install packages before, but could not find one.

  3. I have also looked at this threadwhich gives details of installing a .egg file without using easy install, but cannot figure out what changes I would need to make to the script provided as this is to install a specific package that I already have.

  1. 使用简易安装(从 C:\Python27\Lib\site-packages 目录):

    Python easy_install -Z C:\Users\Prosserc\Downloads\QSTK-0.2.6-py2.7.egg
    

    这在我的站点包目录中创建了一个 QSTK-0.2.6-py2.7.egg 目录,我可以打开并在其中查找文件。但是,我尝试从 python shell 导入 QSTK 并获得通常的“无模块命名...”导入错误。

  2. 我找了一个 setup.py 文件,因为我以前用它们来安装软件包,但找不到。

  3. 我还查看了这个线程,它提供了在不使用简单安装的情况下安装 .egg 文件的详细信息,但无法弄清楚我需要对提供的脚本进行哪些更改,因为这是安装我已经拥有的特定包。

If anyone can help by explaining either how I can install this .egg file correctly or by providing a link to the QSTK modules for python 2.7 64 bit in another format this would be greatly appreciated.

如果有人可以通过解释我如何正确安装此 .egg 文件或通过提供另一种格式的 python 2.7 64 位 QSTK 模块的链接来提供帮助,我们将不胜感激。

I have managed to install the packages that QSTK is dependant on okay (numpy, scipy, matplotlib, pandas, python-dateutil and scikit-learn).

我已经成功安装了 QSTK 依赖的软件包(numpy、scipy、matplotlib、pandas、python-dateutil 和 scikit-learn)。

采纳答案by ChrisProsser

I have finally found another place to download this from with a package that works: https://pypi.python.org/pypi/QSTK/0.2.6has a QSTK-0.2.6.tar.gz option to build it from the source code.

我终于找到了另一个地方可以使用一个有效的包下载它:https://pypi.python.org/pypi/QSTK/0.2.6 有一个 QSTK-0.2.6.tar.gz 选项可以从源代码。

Unzipping this (then again once down to the .tar), I could find the setup.py file and install by going to the directory with the setup file and running:

解压缩它(然后再次解压到 .tar),我可以找到 setup.py 文件并通过转到包含安装文件的目录并运行来安装:

python setup.py install

回答by Erik Kaplun

How about if you unpack the .egg(it's just a .zipin disguise), then cdinto it and run python setup.py install? Will that run fine and will you then be able to import your module?

如果你打开包装.egg(它只是一个.zip伪装),然后cd进入它并运行python setup.py install怎么样?这会运行良好,然后您可以导入您的模块吗?

I'm saying this because if the .eggfile does get put under site-packagesas appropriate but you're still not able to import, this might be a problem in the code itself.

我这么说是因为如果.egg文件确实被site-packages适当地放入了但您仍然无法导入,这可能是代码本身的问题。

回答by new2cpp

I found pip install qstkworks perfectly for 64x 2.7 python at win 7

我发现pip install qstk在 win 7 下非常适合 64x 2.7 python

回答by Ali Asghar Taghizadeh

You should add -m before easy_install
for example:

您应该在 easy_install 之前添加 -m
例如:

python -m easy_install C:\Users\Prosserc\Downloads\QSTK-0.2.6-py2.7.egg

回答by Blossom

I tried copying the contents of the .egg folder in the path Lib\site-packages . It worked and didn't throw any ModuleNotFoundError .

我尝试复制路径 Lib\site-packages 中 .egg 文件夹的内容。它有效并且没有抛出任何 ModuleNotFoundError 。