首页 > 解决方案 > 如何使用正确版本的python(OSX)?

问题描述

我安装了以下版本的python。

$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
$ which python3
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
$ which python2
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2

allennlp 安装在这里。

$ which allennlp
/Library/Frameworks/Python.framework/Versions/3.6/bin/allennlp

但是当我运行 allennlp 时。它显然使用了 python 版本 2。我不想手动编辑 allennlp 或创建指向 python3 的新 python 符号链接。

$ echo "The cryptocurrency space is now figuring out to have the highest search on Google globally ." > sentences.txt
$ echo "Bitcoin alone has a sixty percent share of global search ." >> sentences.txt
$ allennlp elmo sentences.txt elmo_layers.hdf5
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named allennlp

有谁知道处理这种情况的最佳方法是什么?谢谢。

标签: pythonmacosallennlp

解决方案


推荐阅读