Как я могу установить argparse в Python 3.1? - PullRequest
3 голосов
/ 08 января 2011

Я пытаюсь установить argparse для установки в Python 3.1, но я получаю UnicodeDecodeError из setup.py, когда я его просто устанавливаю:

(ve31) offline@void (projects) $ easy_install argparse
install_dir /Users/offline/tmp/ve31/lib/python3.1/site-packages/
Searching for argparse
Reading http://pypi.python.org/simple/argparse/
Reading http://code.google.com/p/argparse/
Reading http://argparse.python-hosting.com/
Download error: [Errno 8] nodename nor servname provided, or not known -- Some packages may not be found!
Reading http://argparse.python-hosting.com/
Download error: [Errno 8] nodename nor servname provided, or not known -- Some packages may not be found!
Page at http://pypi.python.org/simple/argparse/ links to .py file(s) without version info; an index scan is required.
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
Reading http://argparse.python-hosting.com/file/trunk/argparse.py?rev=6&format=raw
Download error: [Errno 8] nodename nor servname provided, or not known -- Some packages may not be found!
Reading http://argparse.python-hosting.com/
Download error: [Errno 8] nodename nor servname provided, or not known -- Some packages may not be found!
Reading http://argparse.python-hosting.com/
Download error: [Errno 8] nodename nor servname provided, or not known -- Some packages may not be found!
Reading http://argparse.python-hosting.com/
Download error: [Errno 8] nodename nor servname provided, or not known -- Some packages may not be found!
Reading http://argparse.python-hosting.com/
Download error: [Errno 8] nodename nor servname provided, or not known -- Some packages may not be found!
Reading http://argparse.python-hosting.com/
Download error: [Errno 8] nodename nor servname provided, or not known -- Some packages may not be found!
Reading http://argparse.python-hosting.com/
Download error: [Errno 8] nodename nor servname provided, or not known -- Some packages may not be found!
Reading http://argparse.python-hosting.com/
Download error: [Errno 8] nodename nor servname provided, or not known -- Some packages may not be found!
Best match: argparse 1.1
Downloading http://pypi.python.org/packages/source/a/argparse/argparse-1.1.zip#md5=087399b73047fa5a6482037411ddc968
Processing argparse-1.1.zip
Running argparse-1.1/setup.py -q bdist_egg --dist-dir /var/folders/jj/jjpHKlEGGDCZAkn87y0qBU+++TI/-Tmp-/easy_install-DQ9nUb/argparse-1.1/egg-dist-tmp-zMCdC1
Traceback (most recent call last):
  File "/Users/offline/tmp/ve31/bin/easy_install", line 9, in <module>
    load_entry_point('distribute==0.6.14', 'console_scripts', 'easy_install')()
  File "/Users/offline/tmp/ve31/lib/python3.1/site-packages/distribute-0.6.14-py3.1.egg/setuptools/command/easy_install.py", line 1855, in main
    with_ei_usage(lambda:
  File "/Users/offline/tmp/ve31/lib/python3.1/site-packages/distribute-0.6.14-py3.1.egg/setuptools/command/easy_install.py", line 1836, in with_ei_usage
    return f()
  File "/Users/offline/tmp/ve31/lib/python3.1/site-packages/distribute-0.6.14-py3.1.egg/setuptools/command/easy_install.py", line 1859, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "/usr/local/Cellar/python3/3.1.3/lib/python3.1/distutils/core.py", line 149, in setup
    dist.run_commands()
  File "/usr/local/Cellar/python3/3.1.3/lib/python3.1/distutils/dist.py", line 919, in run_commands
    self.run_command(cmd)
  File "/usr/local/Cellar/python3/3.1.3/lib/python3.1/distutils/dist.py", line 938, in run_command
    cmd_obj.run()
  File "/Users/offline/tmp/ve31/lib/python3.1/site-packages/distribute-0.6.14-py3.1.egg/setuptools/command/easy_install.py", line 342, in run
    self.easy_install(spec, not self.no_deps)
  File "/Users/offline/tmp/ve31/lib/python3.1/site-packages/distribute-0.6.14-py3.1.egg/setuptools/command/easy_install.py", line 582, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/Users/offline/tmp/ve31/lib/python3.1/site-packages/distribute-0.6.14-py3.1.egg/setuptools/command/easy_install.py", line 612, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/Users/offline/tmp/ve31/lib/python3.1/site-packages/distribute-0.6.14-py3.1.egg/setuptools/command/easy_install.py", line 802, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/Users/offline/tmp/ve31/lib/python3.1/site-packages/distribute-0.6.14-py3.1.egg/setuptools/command/easy_install.py", line 1079, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/Users/offline/tmp/ve31/lib/python3.1/site-packages/distribute-0.6.14-py3.1.egg/setuptools/command/easy_install.py", line 1068, in run_setup
    run_setup(setup_script, args)
  File "/Users/offline/tmp/ve31/lib/python3.1/site-packages/distribute-0.6.14-py3.1.egg/setuptools/sandbox.py", line 30, in run_setup
    lambda: exec(compile(open(
  File "/Users/offline/tmp/ve31/lib/python3.1/site-packages/distribute-0.6.14-py3.1.egg/setuptools/sandbox.py", line 71, in run
    return func()
  File "/Users/offline/tmp/ve31/lib/python3.1/site-packages/distribute-0.6.14-py3.1.egg/setuptools/sandbox.py", line 31, in <lambda>
    "setup.py"
  File "/Users/offline/tmp/ve31/lib/python3.1/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 39: ordinal not in range(128)

Как я могу получить этот очень полезный модуль вмой Python 3.1 virtualenv?

Обновление

Для полноты, вот вопрос времени выполнения:

$ python3.1
Python 3.1.3 (r313:86834, Jan  2 2011, 21:23:36) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin

$ virtualenv5 --version
1.3.4.5

$ uname -a # OSX 10.6.6
Darwin void.local 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386

1 Ответ

1 голос
/ 09 января 2011

Я скачал файл из pypi, разархивировал его и запустил python3 setup.py install. Нет ошибок Это с Python 3.1.2 на Ubuntu 10.04.

$ wget http://argparse.googlecode.com/files/argparse-1.2.1.tar.gz
$ tar -zxvf argparse-1.2.1.tar.gz
$ cd argparse
$ python3 setup.py install

easy_install также работал, но у меня есть Distribute 0.6.4.

Я подозреваю, что причиной вашей проблемы является ошибка в Distribute 0.6.14. Подайте отчет об ошибке. :)

...