我找不到我的OSX通天安装导入CLDR通天文件setup.py,我究竟做错了什么?(I cannot

2019-10-19 04:35发布

我一直在试图对我的iMac使用巴贝尔(OSX小牛,我使用的MacPorts安装了Python和巴贝尔),但我收到此错误信息:

[...]
writing PO template file to ./locale/messages.pot
Traceback (most recent call last):
  File "/usr/local/bin/pybabel", line 8, in <module>
    load_entry_point('Babel==2.0-dev-20131218', 'console_scripts', 'pybabel')()
  File "/Library/Python/2.7/site-packages/Babel-2.0_dev_20131218-py2.7.egg/babel/messages/frontend.py", line 1151, in main
    return CommandLineInterface().run(sys.argv)
  File "/Library/Python/2.7/site-packages/Babel-2.0_dev_20131218-py2.7.egg/babel/messages/frontend.py", line 665, in run
    return getattr(self, cmdname)(args[1:])
  File "/Library/Python/2.7/site-packages/Babel-2.0_dev_20131218-py2.7.egg/babel/messages/frontend.py", line 947, in extract
    sort_by_file=options.sort_by_file)
  File "/Library/Python/2.7/site-packages/Babel-2.0_dev_20131218-py2.7.egg/babel/messages/pofile.py", line 427, in write_po
    messages = list(catalog)
  File "/Library/Python/2.7/site-packages/Babel-2.0_dev_20131218-py2.7.egg/babel/messages/catalog.py", line 552, in __iter__
    for name, value in self.mime_headers:
  File "/Library/Python/2.7/site-packages/Babel-2.0_dev_20131218-py2.7.egg/babel/messages/catalog.py", line 337, in _get_mime_headers
    locale='en')))
  File "/Library/Python/2.7/site-packages/Babel-2.0_dev_20131218-py2.7.egg/babel/dates.py", line 609, in format_datetime
    locale = Locale.parse(locale)
  File "/Library/Python/2.7/site-packages/Babel-2.0_dev_20131218-py2.7.egg/babel/core.py", line 284, in parse
    language = get_global('language_aliases').get(language, language)
  File "/Library/Python/2.7/site-packages/Babel-2.0_dev_20131218-py2.7.egg/babel/core.py", line 53, in get_global
    _raise_no_data_error()
  File "/Library/Python/2.7/site-packages/Babel-2.0_dev_20131218-py2.7.egg/babel/core.py", line 25, in _raise_no_data_error
  raise RuntimeError('The babel data files are not available. '
RuntimeError: The babel data files are not available. This usually happens because you are using a source checkout from Babel and you did not build the data files.  Just make sure to run "python setup.py import_cldr" before installing the library.

我不能运行下面的命令,因为我无法找到setup.py文件在我的Mac上的.egg档案

>python setup.py import_cldr

试图运行通天的另一个版本我下载导致这个错误的setup.py,但即使我能做到这一点就不会解决我的问题,我认为:

> python setup.py import_cldr
running import_cldr
Local copy '/Users/Ailete/Downloads/Babel-1.3/cldr/core-23.1.zip' not found
Downloading 'core-23.1.zip'
Traceback (most recent call last):
  File "scripts/download_import_cldr.py", line 104, in <module>
    main()
  File "scripts/download_import_cldr.py", line 82, in main
    urlretrieve(URL, zip_path, reporthook)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py",     line 94, in urlretrieve
    return _urlopener.retrieve(url, filename, reporthook, data)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 244, in retrieve
    tfp = open(filename, 'wb')
IOError: [Errno 2] No such file or directory: '/Users/Ailete/Downloads/Babel-1.3/cldr/core-23.1.zip'

有关如何安装CLDR文件的.egg安装任何想法?

这里是巴贝尔包我的机器上的内容:

> cd /Library/Python/2.7/site-packages/Babel-2.0_dev_20131218-py2.7.egg/
> ls
EGG-INFO    babel
> cd babel
> ls
__init__.py     core.py     localedata.py   numbers.py  support.py
__init__.pyc    core.pyc    localedata.pyc  numbers.pyc support.pyc
_compat.py      dates.py    localtime       plural.py   util.py
_compat.pyc     dates.pyc   messages        plural.pyc  util.pyc

而一些命令的结果我想:

> cd /Library/Python/2.7/site-packages/Babel-2.0_dev_20131218-py2.7.egg/babel
> python setup.py import_cldr
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory
> python setup.py install
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory

Answer 1:

你必须进入它的目录,然后键入:“蟒的setup.py安装”(不带引号)。

〜托马斯



Answer 2:

我想我是在看一个版本的系统中安装了巴别...

我发现,安装MacPorts的事情:

/opt/local/

我需要的CLDR文件似乎位于:

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/babel/localedata/

我现在需要找到如何正确设置对小牛的路径...但我的问题似乎是,该系统不使用巴贝尔的正确版本。

谢谢您的回答,我会做一个新的问题,以帮助我的路径配置。



文章来源: I cannot find setup.py in my OSX babel installation to import the cldr babel files, what am I doing wrong?