1

我试过谷歌搜索,但没有找到太多/任何东西,以下也没有帮助......

https://ipython.org/ipython-doc/3/interactive/magics.html

典型的用例是:

In [31]: from sqlalch<TAB>  
Caching the list of root modules, please wait!
(This will only be done once - type '%rehashx' to reset cache!)

em
Caching the list of root modules, please wait!
(This will only be done once - type '%rehashx' to reset cache!)


Caching the list of root modules, please wait!
(This will only be done once - type '%rehashx' to reset cache!)


                        sqlalchemy 

自己运行%rehashx也无济于事。我也安装了 pip pyreadline

任何想法出了什么问题?%rehashx存储信息在哪里?

编辑

的输出get_ipython().db['rootmodules_cache']给出以下内容:

for key in d.keys(): print key
# /usr/local/bin
# /usr/lib/python3/dist-packages
# /usr/lib/python3.5
# /usr/local/lib/python3.5/dist-packages <- should be in here
# /usr/lib/python3.5/lib-dynload
# /usr/lib/python35.zip
# /usr/local/lib/python3.5/dist-packages/IPython/extensions
# /usr/lib/python3.5/plat-x86_64-linux-gnu
# /home/user/.ipython

import sqlalchemy
sqlalchemy.__file__
# /user/local/lib/python3.5/dist-packages/sqlalchemy/__init__.py

但是 sqlalchemy 不在列表中

d = get_ipython().db['rootmodules_cache']
'sqlalchemy' in d['/user/local/lib/python3.5/dist-packages']
# False
4

1 回答 1

0

这个命令在 Ipython 中为我解决了:

!rm .ipython/profile_default/db/*

我希望它会增加你的。

于 2019-03-29T18:27:37.313 回答