问题
My ipython works okay, but when I try to open ipython console from venv I am getting:
Traceback (most recent call last):
File "/usr/bin/ipython3", line 4, in <module>
from IPython import start_ipython
ImportError: No module named 'IPython'
Any ways to do this?
回答1:
Did you by any chance create the venv with the --system-site-packages flag and install ipython with pip? This combination is broken in my experience (Python 3.6.2, pip 9.0.1).
Two workarounds are:
- Use
virtualenvinstead ofvenv, - Or use
easy_installinstead ofpip.
With pip, scripts get the wrong shebang pointing to system python.
回答2:
have you activated your virtualenv and installed ipython into the virtualenv?
source path/to/venv/bin/activate
pip install ipython
来源:https://stackoverflow.com/questions/32183161/how-to-run-ipython-from-venv