繁体   English   中英

无法正确安装python-pip模块

[英]Can't install module with python-pip properly

我想安装一个模块,但是pip没有安装在正确的目录中,我认为应该是/usr/local/lib/python2.7/site-packages/ 毕竟,我今天刚刚安装了Python 2.7.2。 最初我有2.6.5并且在那里成功安装了模块。 所以我觉得我的Python路径有问题。

如何让我的所有模块安装到正确的python2.7目录?

s3z@s3z-laptop:~$ pip install requests
Requirement already satisfied: requests in /usr/local/lib/python2.6/dist-packages/requests-0.6.1-py2.6.egg
Installing collected packages: requests
Successfully installed requests
s3z@s3z-laptop:~$ python
Python 2.7.2 (default, Oct  1 2011, 14:26:08) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named requests
>>> ^Z
[3]+  Stopped                 python

这也是我的Python目录现在的样子http://pastie.org/2623543

安装Python 2.7之后,你是否安装了easy2install和PIP的Python 2.7版本? 现有安装配置为默认使用Python 2.6,这可能会导致您的问题。

您可能正在使用链接到python2.6的pip而不是2.7。 如果你已经用python2.7正确安装了pip ,你可以这样做:

pip-2.7 install requests

如果没有,请尝试以这种方式安装:

curl -O http://python-distribute.org/distribute_setup.py
[sudo] python2.7 distribute_setup.py
curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
[sudo] python2.7 get-pip.py

暂无
暂无

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

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