python 路径对 IPython 笔记本重要吗?
Does python paths matter for IPython notebook?
我是 IPython 的新手,我在使用笔记本时遇到了这个尴尬的问题:
当我尝试使用 matplotlib 时
%matplotlib inline
我收到这个错误:
ImportError: /home/ipython/anaconda2/bin/../lib/libgfortran.so.3:
version `GFORTRAN_1.4' not found (required by /usr/lib/liblapack.so.3)
但是..如果我在之前:
执行下面的代码
import sys
sys.path.reverse()
有效!
问题是:python 路径的顺序重要吗?我是否需要以正确的顺序安装 python 依赖项或将 python 路径设置为正确的顺序?
谢谢!
PS: 我正在使用 jupyter server 4.
我确信路径很重要,但与任何其他 python 程序一样。
When a module named spam is imported, the interpreter first searches
for a built-in module with that name. If not found, it then searches
for a file named spam.py in a list of directories given by the
variable sys.path.
https://docs.python.org/2/tutorial/modules.html#the-module-search-path
无论如何,我认为您应该先尝试这个 workaround,即添加到您的 .bashrc
:
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgfortran.so.3
如果没有帮助,您可以尝试在 .bashrc 中更改 PYTHONPATH
。 Anaconda 将自己添加到那里。所以你可以互换它。
改成source ~/.bashrc
后不要忘记重新加载.bashrc
我是 IPython 的新手,我在使用笔记本时遇到了这个尴尬的问题:
当我尝试使用 matplotlib 时
%matplotlib inline
我收到这个错误:
ImportError: /home/ipython/anaconda2/bin/../lib/libgfortran.so.3: version `GFORTRAN_1.4' not found (required by /usr/lib/liblapack.so.3)
但是..如果我在之前:
执行下面的代码import sys
sys.path.reverse()
有效!
问题是:python 路径的顺序重要吗?我是否需要以正确的顺序安装 python 依赖项或将 python 路径设置为正确的顺序?
谢谢!
PS: 我正在使用 jupyter server 4.
我确信路径很重要,但与任何其他 python 程序一样。
When a module named spam is imported, the interpreter first searches for a built-in module with that name. If not found, it then searches for a file named spam.py in a list of directories given by the variable sys.path.
https://docs.python.org/2/tutorial/modules.html#the-module-search-path
无论如何,我认为您应该先尝试这个 workaround,即添加到您的 .bashrc
:
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgfortran.so.3
如果没有帮助,您可以尝试在 .bashrc 中更改 PYTHONPATH
。 Anaconda 将自己添加到那里。所以你可以互换它。
改成source ~/.bashrc
.bashrc