在 ubuntu 11.04 上安装 pymongo3-1.9b1

发布于 2024-12-09 11:01:31 字数 4536 浏览 0 评论 0原文

根据手册,我尝试了以下两种方法在ubuntu 11.0中安装pymongo 没有成功。任何建议表示赞赏!

方法一:

user@ubuntu:~/Downloads/pymongo3-1.9b1$ sudo python3.2 setup.py install
Extracting in /tmp/tmp206r5e
Traceback (most recent call last):
  File "/home/user/Downloads/pymongo3-1.9b1/distribute_setup.py", line 139, in use_setuptools
    import pkg_resources
ImportError: No module named pkg_resources

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 9, in <module>
    use_setuptools()
  File "/home/user/Downloads/pymongo3-1.9b1/distribute_setup.py", line 145, in use_setuptools
    return _do_download(version, download_base, to_dir, download_delay)
  File "/home/user/Downloads/pymongo3-1.9b1/distribute_setup.py", line 125, in _do_download
    _build_egg(egg, tarball, to_dir)
  File "/home/user/Downloads/pymongo3-1.9b1/distribute_setup.py", line 98, in _build_egg
    tar = tarfile.open(tarball)
  File "/usr/local/lib/python3.2/tarfile.py", line 1744, in open
    raise ReadError("file could not be opened successfully")
tarfile.ReadError: file could not be opened successfully

方法二:

user@ubuntu:~/Downloads/pymongo3-1.9b1$ sudo easy_install pymongo3
Searching for pymongo3
Reading http://pypi.python.org/simple/pymongo3/
Reading http://github.com/agronholm/mongo-python-driver-py3k
Best match: pymongo3 1.9b1
Downloading http://pypi.python.org/packages/source/p/pymongo3/pymongo3-1.9b1.tar.gz#md5=6c65dcad8674f37ffc8bc3d6e1fd4155
Processing pymongo3-1.9b1.tar.gz
Running pymongo3-1.9b1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Iv0ZIq/pymongo3-1.9b1/egg-dist-tmp-sUlwd7
Traceback (most recent call last):
  File "/usr/bin/easy_install", line 9, in <module>
    load_entry_point('distribute==0.6.15', 'console_scripts', 'easy_install')()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1906, in main
    with_ei_usage(lambda:
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1887, in with_ei_usage
    return f()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1910, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 363, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 603, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 633, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 823, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1100, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1089, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 29, in run_setup
    lambda: execfile(
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 70, in run
    return func()
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 31, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'}
  File "setup.py", line 150
SyntaxError: Non-ASCII character '\xc3' in file setup.py on line 150, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
user@ubuntu:~/Downloads/pymongo3-1.9b1$ 

我发现我的机器上安装了zlib

user@ubuntu:~/Downloads$ sudo apt-get install zlib1g-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
zlib1g-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 242 not upgraded.

我使用了以下方法安装python 3.2

1> tar -xvf Python-3.2.tgz && cd Python-3.2/
2> ./configure
3> make
4> sudo make altinstall

Based on manual, I have tried the following two methods to install pymongo in ubuntu 11.0
without success. Any suggestion is appreciated!

Method One:

user@ubuntu:~/Downloads/pymongo3-1.9b1$ sudo python3.2 setup.py install
Extracting in /tmp/tmp206r5e
Traceback (most recent call last):
  File "/home/user/Downloads/pymongo3-1.9b1/distribute_setup.py", line 139, in use_setuptools
    import pkg_resources
ImportError: No module named pkg_resources

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 9, in <module>
    use_setuptools()
  File "/home/user/Downloads/pymongo3-1.9b1/distribute_setup.py", line 145, in use_setuptools
    return _do_download(version, download_base, to_dir, download_delay)
  File "/home/user/Downloads/pymongo3-1.9b1/distribute_setup.py", line 125, in _do_download
    _build_egg(egg, tarball, to_dir)
  File "/home/user/Downloads/pymongo3-1.9b1/distribute_setup.py", line 98, in _build_egg
    tar = tarfile.open(tarball)
  File "/usr/local/lib/python3.2/tarfile.py", line 1744, in open
    raise ReadError("file could not be opened successfully")
tarfile.ReadError: file could not be opened successfully

Method Two:

user@ubuntu:~/Downloads/pymongo3-1.9b1$ sudo easy_install pymongo3
Searching for pymongo3
Reading http://pypi.python.org/simple/pymongo3/
Reading http://github.com/agronholm/mongo-python-driver-py3k
Best match: pymongo3 1.9b1
Downloading http://pypi.python.org/packages/source/p/pymongo3/pymongo3-1.9b1.tar.gz#md5=6c65dcad8674f37ffc8bc3d6e1fd4155
Processing pymongo3-1.9b1.tar.gz
Running pymongo3-1.9b1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Iv0ZIq/pymongo3-1.9b1/egg-dist-tmp-sUlwd7
Traceback (most recent call last):
  File "/usr/bin/easy_install", line 9, in <module>
    load_entry_point('distribute==0.6.15', 'console_scripts', 'easy_install')()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1906, in main
    with_ei_usage(lambda:
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1887, in with_ei_usage
    return f()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1910, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 363, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 603, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 633, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 823, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1100, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1089, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 29, in run_setup
    lambda: execfile(
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 70, in run
    return func()
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 31, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'}
  File "setup.py", line 150
SyntaxError: Non-ASCII character '\xc3' in file setup.py on line 150, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
user@ubuntu:~/Downloads/pymongo3-1.9b1$ 

I found that I have the zlib installed on my machine

user@ubuntu:~/Downloads$ sudo apt-get install zlib1g-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
zlib1g-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 242 not upgraded.

I have used the following method to install python 3.2

1> tar -xvf Python-3.2.tgz && cd Python-3.2/
2> ./configure
3> make
4> sudo make altinstall

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月牙弯弯 2024-12-16 11:01:31

第二个错误的罪魁祸首是以下行:

maintainer="Alex Grönholm",

它使用变音符号,但未声明文件编码,并且默认为 ASCII。

使用获取包源代码,

easy_install --editable --build-directory ~/Desktop pymongo3

然后编辑 ~/pymongo3/setup.py 并修复/删除有问题的行。您应该能够使用安装

easy_install ~/Desktop/pymongo3

继续进行,为我解析 setup.py,然后在 Python 3 中引入的模块上崩溃。(我手边只有 2.7。)

您还应该至少报告这一点作为一个错误。

The culprit for the second error is the line:

maintainer="Alex Grönholm",

which uses an umlaut but the file encoding isn't declared and defaults to ASCII.

Grab the package source using

easy_install --editable --build-directory ~/Desktop pymongo3

then edit ~/pymongo3/setup.py and fix / delete the offending line. You should be able to install using

easy_install ~/Desktop/pymongo3

The installation proceeds past parsing setup.py for me, then crashes on a module introduced in Python 3. (I only have 2.7 handy.)

You should also at least report this as a bug.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文