如何在Python中安装guess_language包

时间:2012-11-25 14:32:44

标签: python

这个问题可能是微不足道的,但是,诚实,我无法弄明白,因为我是蟒蛇新手。

我运行Python 2.7.3,可以找到前面提到的包here

如果您能确保我已在笔记本电脑上正确安装,我将非常感激。仅供参考,这里是命令输出 $ ./setup.py install $ python2 setup.py install 分别

$ ./setup.py install

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 install

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 个答案:

答案 0 :(得分:2)

您需要以root身份运行setup.py install命令:

sudo python setup.py install

否则您无权将文件复制到/usr/local/lib/python3.2/dist-packages目录。

要在Python 2上安装软件包,您需要先安装3to2 package

答案 1 :(得分:0)

现在你可以使用pip - python包管理器来安装它:

  1. 您需要安装pip - 然后
  2. 只需:pip install guess_language