【问题标题】:Installing a Python module in Windows在 Windows 中安装 Python 模块
【发布时间】:2011-12-28 08:30:36
【问题描述】:

我正在尝试在我的 Windows 计算机上安装 Python 模块。我安装了 NetBeans IDE 的开发版本用作我的 Python 编辑器,他们似乎将 Jython 2.5 安装在自己的程序文件夹下,并强制您使用该安装进行开发。

我已经尝试安装 PyWhois 模块半小时了,我对在 Windows 上使用 Netbeans 开发 Python 的笨拙感到非常愤怒。

有人知道如何使用此设置安装模块吗?我应该破坏我的开发环境并使用其他不会引起愤怒的东西吗?

【问题讨论】:

    标签: python windows netbeans module pywhois


    【解决方案1】:

    Jython 是用于 Java 的 Python - 您确定这是您想要的吗?我已经为 Windows 的“普通”Python 回答了这个问题,我认为这就是你所追求的。

    要在 Windows 下使用 Python,您需要安装 Windows 二进制安装程序,您可以从 the Python download page 下载。确保选择二进制安装程序。

    接下来,您需要安装setuptools,您可以从python package index (pypi) 获得。

    一旦你安装了两者,你就可以在 Windows 下使用 Python。您应该能够打开命令提示符并键入“python”以获取 python 提示符,它应该如下所示:

    Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on
    win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>>
    

    然后,要安装 PyWhois,请打开命令提示符并键入:

    C:\>easy_install pywhois
    

    你会看到这样的输出:

    Searching for pywhois
    Reading http://pypi.python.org/simple/pywhois/
    Best match: pywhois 0.1
    Downloading http://pypi.python.org/packages/source/p/pywhois/pywhois-0.1.tar.gz#
    md5=b888dcd990574b7b284d9a9f4b300776
    Processing pywhois-0.1.tar.gz
    Running pywhois-0.1\setup.py -q bdist_egg --dist-dir c:\docume~1\40843\locals~1\
    temp\easy_install-hugnul\pywhois-0.1\egg-dist-tmp-aarhii
    Adding pywhois 0.1 to easy-install.pth file
    Installing pywhois-script.py script to C:\Python27\Scripts
    Installing pywhois.exe script to C:\Python27\Scripts
    Installing pywhois.exe.manifest script to C:\Python27\Scripts
    
    Installed c:\python27\lib\site-packages\pywhois-0.1-py2.7.egg
    Processing dependencies for pywhois
    Finished processing dependencies for pywhois
    

    要确认它已安装,您应该能够从 Python 导入它:

    Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on
    win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pywhois
    >>>
    

    Netbeans 7.0 已删除 Python 支持(请参阅http://wiki.netbeans.org/Python70Roadmap)以了解更多信息。

    http://wiki.python.org/moin/IntegratedDevelopmentEnvironments wiki 条目列出了您可以尝试的其他一些 IDE。

    【讨论】:

    • 你知道如何为 Python 3.2 安装 easy_install 吗?它似乎不适用于我在 Python 网站上找到的安装程序代码。
    • 我一直在考虑回到 Python 2.7 - 你会推荐这个,还是值得围绕新版本工作?
    • 简易安装(setuptools 的一部分)正在移植到 3.0。如果必须使用3.0,请使用distribute;我个人仍然使用 2.7.2,因为我使用的大多数库还没有移植到 3.0。
    • 我回到了 2.7,但我想迁移到 3.0 并没有什么紧迫的事情。这不值得恶化。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-01-23
    • 2013-10-06
    • 2011-07-28
    • 1970-01-01
    • 2013-08-23
    • 2019-03-02
    • 1970-01-01
    相关资源
    最近更新 更多