2011-11-14 84 views
2

我試圖在Windows計算機上安裝Python模塊。我安裝了NetBeans IDE的開發版本以用作我的Python編輯器,似乎他們將Jython 2.5安裝在自己的程序文件夾下,並強制您使用該安裝進行開發。在Windows中安裝Python模塊

我一直在試圖安裝PyWhois模塊半個小時,現在我對使用Netbeans在Windows上開發Python的感覺非常惱火。

有誰知道如何安裝模塊與此設置?我是否應該摧毀我的開發環境並使用其他不那麼誘人的東西?

回答

5

Jython是Python for Python--你確定這是你想要的嗎?我已經爲Windows的「正常」Python回答了這個問題,我認爲這就是你所追求的。

要在Windows下使用Python,您需要安裝Windows二進制安裝程序,您可以從the Python download page下載該程序。確保您選擇二進制安裝程序。

接下來,您將需要安裝setuptools,您可以從python package index (pypi)獲得。

一旦安裝了兩者,就可以在Windows下使用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中導入:

Netbeans 7.0已刪除Python支持(請參閱http://wiki.netbeans.org/Python70Roadmap)以獲取更多信息。

http://wiki.python.org/moin/IntegratedDevelopmentEnvironments維基條目列出了一些其他可以嘗試的IDE。

+0

你知道如何爲Python 3.2安裝easy_install嗎?它似乎沒有與我在Python網站上找到的安裝程序代碼一起工作。 – MarathonStudios

+0

我一直在考慮回到Python 2.7 - 你會推薦這個,還是值得它來解決新版本? – MarathonStudios

+0

安裝簡單(部分setuptools)正在移植到3.0。如果您必須使用3.0,請使用[distribute](http://code.activestate.com/pypm/distribute/);我個人仍然使用2.7.2,因爲我使用的大多數庫都沒有移植到3.0。 –