我试图在虚拟环境中安装pymongo,而pip表示它已安装,但它似乎不是:
(venv)$ ./myapp.py
Traceback (most recent call last):
File "./myapp.py", line 5, in <module>
import myAppMongo
File "/home/me/python/myapp/myAppMongo.py", line 4, in <module>
from pymongo import MongoClient
ImportError: No module named 'pymongo'
我已经安装了pymongo:
(venv)$ pip --no-cache install pymongo
Collecting pymongo
Downloading pymongo-3.2.tar.gz (473kB)
100% |████████████████████████████████| 475kB 18.3MB/s
Installing collected packages: pymongo
Running setup.py install for pymongo ... done
Successfully installed pymongo
但它并没有出现在pip的冻结输出中:
(venv)$ pip freeze |grep -ic pymongo
0
我用他们的python 3软件包运行亚马逊的Linux:
(venv)$ sudo yum list installed|grep -i python3
python34.x86_64 3.4.3-1.30.amzn1 @amzn-main
python34-devel.x86_64 3.4.3-1.30.amzn1 @amzn-main
python34-libs.x86_64 3.4.3-1.30.amzn1 @amzn-main
python34-pip.noarch 6.1.1-1.21.amzn1 @amzn-main
python34-setuptools.noarch 12.2-1.30.amzn1 @amzn-main
python34-test.x86_64 3.4.3-1.30.amzn1 @amzn-main
python34-tools.x86_64 3.4.3-1.30.amzn1 @amzn-main
python34-virtualenv.noarch 12.0.7-1.12.amzn1 @amzn-updates
我怎样才能使这个工作?
答案 0 :(得分:1)
尝试使用pip3
安装pymongo而不是pip
!
答案 1 :(得分:0)
让我们从头开始:
键入此内容并在此处粘贴响应:
type pip
答案 2 :(得分:0)
我想知道您的虚拟环境是否以某种方式未正确设置?
同时做到
$ which python
和
$ which pip
告诉你这些命令是从venv中运行的吗?