背景資料:試圖安裝在Ubuntu 12.04 pymongo
您好。我試圖讓MongoDB和Python(2.7.8)在我的Ubuntu 12.04盒子上工作。 我已經安裝並運行了mongodb ... 我認爲我也設置了python。現在我正在嘗試安裝pymongo。
問題
當我嘗試安裝pymongo,這是我得到:
[email protected]:~/Documents/Python-2.7.8$ pip install pymongo
Downloading/unpacking pymongo
Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement pymongo
No distributions at all found for pymongo
Storing complete log in /home/me/.pip/pip.log
[email protected]:~/Documents/Python-2.7.8$
日誌文件pip.log看起來是這樣的:基於日誌http://pastebin.com/15wv38kf
,tt *好像我需要更新存儲庫以在不同的URL中查找軟件包......但我不確定要添加哪個庫/網址。
其他的事情我已經測試/檢查:
檢索更新軟件包列表:
sudo apt-get update
證明了Python 2.7.8安裝:
[email protected]:~/Documents/Python-2.7.8$ python
Python 2.7.8 (default, Nov 5 2014, 15:18:10)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
事實證明,PIP已安裝:
[email protected]:~/Documents/Python-2.7.8$ pip
Usage: pip COMMAND [OPTIONS]
pip: error: You must give a command (use "pip help" to see a list of commands)
[email protected]:~/Documents/Python-2.7.8$
事實證明,MongoDB是安裝(但顯然不是正確安裝!):
[email protected]:~/Documents/Python-2.7.8$ mongo
MongoDB shell version: 2.6.5
connecting to: test
2014-11-06T08:23:47.444-0500 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2014-11-06T08:23:47.444-0500 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed
[email protected]:~/Documents/Python-2.7.8$
任何建議,將不勝感激。
編輯1
我試着只是用包管理器的建議安裝,但似乎並沒有工作。請看結果在:http://pastebin.com/V56KXzFT
也許我的測試證明pymongo安裝是錯誤的?
EDIT 2
我現在不記得,但我認爲Ubuntu默認12.0.4與Python 2.7.3或類似的東西。但我正在學習一門課,它需要2.7.8。 起初,我下載了一個壓縮文件的Python 2.7.6,在我的文檔文件夾中保存它...
我是解壓並運行
./compile
make
make install
然後我意識到我需要2.7.8我也這樣做一樣的東西。下載了zip ...和 編譯。 這是我用作參考安裝2.7.8的鏈接: https://askubuntu.com/questions/101591/how-do-i-install-python-2-7-2-on-ubuntu
這可能與問題有關嗎?
如果點子是給你一個困難時期,儘量只通過Debian軟件包使用'sudo apt-get的安裝python-pymongo'安裝。 – CasualDemon 2014-11-06 14:10:05
@CasualDemon,感謝您的幫助。請在後期看到我的編輯1 ...它沒有工作。 – dot 2014-11-06 14:13:59
你在虛擬環境中工作嗎?如果它是'virtualenv --system-site-packages',你將不得不使用繼承的包創建它。 – CasualDemon 2014-11-06 14:20:26