1

这个问题可能是微不足道的,但老实说,我无法弄清楚,因为我是 python 新手。

我运行 Python 2.7.3,前面提到的包可以在这里找到

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

$ ./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.
4

2 回答 2

2

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

sudo python setup.py install

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

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

于 2012-11-25T14:34:37.437 回答
1

These days you can just use pip - the python package manager to install it:

  1. You'll need to install pip - and then
  2. simply: pip install guess_language
于 2015-08-30T06:36:59.643 回答