2012-11-25 77 views
1

這個問題可能是微不足道的,但誠實,我不明白,因爲我是新的python。如何在Python中安裝guess_language包

我運行Python 2.7.3和上述包裝可以發現here

我真的很感激,如果你能幫助確保我已經正確安裝了它在我的筆記本電腦。 FYI這裏是命令輸出$ ./setup.py安裝$ python2的setup.py分別安裝

$ ./setup.py安裝

running install 
running build 
running build_py 
creating build/lib 
creating build/lib/guess_language 
copying guess_language/__main__.py -> build/lib/guess_language 
copying guess_language/__init__.py -> build/lib/guess_language 
copying guess_language/console_mode.py -> build/lib/guess_language 
creating build/lib/guess_language/data 
copying guess_language/data/__init__.py -> build/lib/guess_language/data 
creating build/lib/guess_language/data/models 
copying guess_language/data/models/az.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/tl.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/pt.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/hu.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/so.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/pt_br.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/da.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/tn.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/fr.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/fi.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/__init__.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/is.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/id.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/bg.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/la.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/sl.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/pl.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/ca.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/ru.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/sk.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/lt.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/ne.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/af.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/haw.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/sq.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/nl.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/ceb.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/nso.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/en.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/uz.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/es.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/ts.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/cs.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/sw.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/mn.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/ro.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/hi.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/tlh.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/lv.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/zu.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/vi.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/ar.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/ss.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/pt_pt.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/it.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/de.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/ky.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/sv.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/ha.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/cy.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/xh.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/fa.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/kk.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/et.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/tr.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/st.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/sr.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/ve.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/ur.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/ps.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/nb.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/eu.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/nr.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/uk.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/mk.py -> build/lib/guess_language/data/models 
copying guess_language/data/models/hr.py -> build/lib/guess_language/data/models 
running install_lib 
running install_egg_info 
Removing /usr/local/lib/python3.2/dist-packages/guess_language_spirit-0.5a3.egg-info 
error: /usr/local/lib/python3.2/dist-packages/guess_language_spirit-0.5a3.egg-info: Permission denied 

$ python2的setup.py安裝

Traceback (most recent call last): 
    File "setup.py", line 597, in <module> 
    sys.exit(main()) 
    File "setup.py", line 592, in main 
    run_setup_hooks(config) 
    File "setup.py", line 569, in run_setup_hooks 
    func(config) 
    File "setup.py", line 582, in default_hook 
    generate_py2k(config) 
    File "setup.py", line 543, in generate_py2k 
    run_3to2(copied_py_files) 
    File "setup.py", line 374, in run_3to2 
    raise OSError("3to2 script is unavailable.") 
OSError: 3to2 script is unavailable. 

回答

2

你需要以root身份運行命令setup.py install

sudo python setup.py install 

否則,您將無權將文件複製到您的/usr/local/lib/python3.2/dist-packages目錄。

要在Python 2上安裝軟件包,首先需要安裝3to2 package

+0

不是運行的作爲root用戶,你可以使用[virtualenv](http://pypi.python.org/pypi/virtualenv)。 – Kos

+0

@Kos:在Python 3.2中,它需要先以root身份進行安裝。 –

+0

@MartijnPieters雖然這兩個軟件包安裝成功(至少看起來他們是這樣做的),但eclipse不能識別'from guess_language import guess_language'命令......它說「未解析導入」任何建議? – user706838

0

這些天,你可以使用畫中畫 - 蟒蛇包管理器進行安裝:

  1. 您需要安裝點子 - 然後
  2. 簡單:pip install guess_language