在我的python虚拟环境中,我安装了版本为0.19.2的sklearn。然后我启动了python解释器:
import sklearn
sklearn.__version__ # 0.19.2
import sys, subprocess
sys.path.insert(0, '/tmp/user')
subprocess.call(['python','-m','pip','install','scikit-learn','--target=/tmp/user'])
我可以看到它已安装:
Collecting scikit-learn
...
Installing collected packages: numpy, scipy, scikit-learn
Successfully installed numpy-1.16.2 scikit-learn-0.20.3 scipy-1.2.1
然后我重新加载sklearn,出现错误:
reload(sklearn)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/user/sklearn/__init__.py", line 65, in <module>
from .utils._show_versions import show_versions
ImportError: No module named _show_versions
有什么问题的想法吗?谢谢!
答案 0 :(得分:0)