我遇到一个奇怪的问题,我已经安装了python包,但它不能识别它们。请注意,一些包装是可识别的。
导入包
的示例ActivePython 2.7.5.6 (ActiveState Software Inc.) based on
Python 2.7.5 (default, Sep 16 2013, 23:07:15)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
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
每当我尝试使用像
这样的Pip安装它时sudo pip install requests
每当我尝试安装相同的软件包时,我收到此消息。
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/local/lib/python2.7/site-packages
我该怎么做才能解决这个问题?
UPDATE_1
pip --version
pip 7.1.2 from /usr/local/lib/python2.7/site-packages
答案 0 :(得分:2)
找到pip安装包的位置并添加
的路径 export PYTHONPATH=<path>
#my path was /Library/Python/2.7/site-packages
在.bashrc或.profile文件中。