Ask Your Question

Revision history [back]

I know this is not considered a clean and good workaround but at least works for me as issuing pip from sage is somehow seem broken for me and my tries for fixing it failed: just put this line on top of your script import sys; sys.path.append('/usr/local/lib/python2.7/site-packages') (or any other appropriate place your python 2 packages are installed), for example see:

~ sage --python
import Python 2.7.13 (default, Mar 25 2017, 16:37:39) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] 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
>>> import sys; sys.path.append('/usr/local/lib/python2.7/site-packages')
>>> 
>>> import requests
>>> 
>>>