简体   繁体   English

Pip说已经安装了pymongo,但没有安装它

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

I'm trying to install pymongo in a virtual environment, and pip says that it's installed, but it doesn't appear to be: 我正在尝试在虚拟环境中安装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'

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

But it doesn't appear in pip's freeze output: 但它没有出现在pip的冻结输出中:

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

I'm running Amazon's linux with their python 3 packages: 我用他们的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

How can I get this working? 我怎样才能使这个工作?

尝试使用pip3来安装pymongo而不是pip

Let's start from the beginning: 让我们从头开始:

Type this and paste here the response: 输入此内容并在此处粘贴响应:

type pip

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? 告诉你这些命令是从venv中运行的?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM