2016-03-23 5 views
2

リクエストモジュールが自分のシステムにインストールされています。 リクエストモジュールをPythonでインポートするとOS Xで動作しません

pip install requests 

は、今私はrpelそれは私がこの問題 hereための答えを見つけた

Traceback (most recent call last): 
File "<stdin>", line 1, in <module> 
ImportError: No module named requests 

次のエラーで失敗し

import requests 

にリクエストをインポートしようとしていますが、それはありませんtはPython 2.xを同じディレクトリに置くことについて何も言わない。

私のターミナルアウトは、次のとおりです。

MacBook-Pro:~ tanmaybaranwal$ which python 

/usr/bin/python 

MacBook-Pro:~ tanmaybaranwal$ which python2.6 

/usr/bin/python2.6 

MacBook-Pro:~ tanmaybaranwal$ which pip 

/usr/local/bin/pip 

MacBook-Pro:~ tanmaybaranwal$ sudo pip install python-firebase 
Password: 
Requirement already satisfied (use --upgrade to upgrade): python-firebase in /Library/Python/2.7/site-packages 
Requirement already satisfied (use --upgrade to upgrade): requests>=1.1.0 in ./Library/Python/2.7/lib/python/site-packages (from python-firebase) 
Cleaning up... 

MacBook-Pro:~ tanmaybaranwal$ sudo pip install requests 
Requirement already satisfied (use --upgrade to upgrade): requests in ./Library/Python/2.7/lib/python/site-packages 
Cleaning up... 

MacBook-Pro:~ tanmaybaranwal$ python 
Python 2.7.10 (default, Oct 23 2015, 18:05:06) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 

>>> import firebase 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/Library/Python/2.7/site-packages/firebase/__init__.py", line 4, in <module> 
    from firebase import * 
    File "/Library/Python/2.7/site-packages/firebase/firebase.py", line 10, in <module> 
    from .decorators import http_connection 
    File "/Library/Python/2.7/site-packages/firebase/decorators.py", line 1, in <module> 
    import requests 
ImportError: No module named requests 

リストPIPモジュールはまた、任意のrequestsモジュールを持っていません。あなたがピップで何かをインストールするには、正しいpythonを使用している、あなたは-m

$ python -m pip install --user requests 

を経由して、それを実行できることを保証するために

答えて

4

(あなたが--userフラグを省略した場合、あなたはroot権限が必要な場合があります)

+0

OSError:[Errno 13]パーミッションが拒否されました: '/Users/tanmaybaranwal/Library/Python/2.7' –

+0

あなたの権限で何か問題が発生しているかもしれませんが、 'sudo chown -R tanmaybaranwal/Users/tanmaybaranwal/Libarary/Python'を使用して*自分のアカウントに権限を復元します。 –

+0

El-Capitanは、ユーザーがライブラリにファイルを書き込むことを許可していません。それは問題かもしれません。ありがとう。 –

関連する問題