How to run ipython from venv?

筅森魡賤 提交于 2019-12-22 10:46:11

问题


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:

  1. Use virtualenv instead of venv,
  2. Or use easy_install instead of pip.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!