Pymongo安装

时间:2014-02-21 13:35:51

标签: python pymongo

如何在没有互联网连接的redhat服务器上安装pymongo模块。 我下载了源文件并尝试了python setup.py install,它会抛出错误

Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.30.tar.gz Traceback (most recent call last):   File "setup.py", line 25, in <module>
    use_setuptools()   File "/home/MLI/pymongo-2.6.2/distribute_setup.py", line 152, in use_setuptools
    return _do_download(version, download_base, to_dir, download_delay)   File "/home/MLI/pymongo-2.6.2/distribute_setup.py", line 131, in _do_download
    to_dir, download_delay)   File "/home/MLI/pymongo-2.6.2/distribute_setup.py", line 201, in download_setuptools
    src = urlopen(url)   File "/usr/local/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)   File "/usr/local/lib/python2.7/urllib2.py", line 400, in open
    response = self._open(req, data)   File "/usr/local/lib/python2.7/urllib2.py", line 418, in _open
    '_open', req)   File "/usr/local/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)   File "/usr/local/lib/python2.7/urllib2.py", line 1207, in http_open
    return self.do_open(httplib.HTTPConnection, req)   File "/usr/local/lib/python2.7/urllib2.py", line 1177, in do_open
    raise URLError(err) urllib2.URLError: <urlopen error [Errno 111] Connection refused>

请帮我安装,无需访问互联网

3 个答案:

答案 0 :(得分:0)

首先使用pip下载软件包

pip install --download /path/to/some/dir pymongo

下载源文件后,使用此命令安装软件包

pip install --no-index --find-links /path/to/some/dir/ pymongo

希望这有助于您的查询

答案 1 :(得分:0)

您可以从Github克隆Pymongo的源存储库,并在没有互联网的情况下复制另一台机器。

在有互联网的机器上:

$ git clone git://github.com/mongodb/mongo-python-driver.git pymongo
$ scp -r pymongo <username>@<servername>:<location>

在没有互联网的机器上:

$ cd pymongo
$ python setup.py install

我假设你已经在没有互联网的机器上安装了所有依赖项。

答案 2 :(得分:0)

如果要从tar安装,请在调用install之前先构建setup.py

python setup.py build

然后去安装。

 python setup.py install