Pip says that pymongo has been installed, but doesn't show it as installed

99封情书 提交于 2019-12-07 11:10:49

问题


I'm trying to install pymongo in a virtual environment, and pip says that it's installed, but it doesn't appear to be:

(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'

I've installed 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

But it doesn't appear in pip's freeze output:

(venv)$ pip freeze |grep -ic pymongo
0

I'm running Amazon's linux with their python 3 packages:

(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

How can I get this working?


回答1:


Try using pip3 to install pymongo instead of pip!




回答2:


Let’s start from the beginning:

Type this and paste here the response:

type pip



回答3:


I wonder if your virtual environment was somehow not set up correctly?

do both

$ which python

and

$ which pip

Show you that the commands are being run from within the venv?



来源:https://stackoverflow.com/questions/35050524/pip-says-that-pymongo-has-been-installed-but-doesnt-show-it-as-installed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!