0

私の R バージョンは 3.4.1、python バージョンは 3.5.2 、OS は Ubuntu 16.04.2 です

rPython のデフォルトの Python バージョンである rPython をインストールするときに、RPYTHON_PYTHON_VERSION=3.5 を設定しました。

♥ python.exec('import sys')
♥ python.exec('print(sys.version)')
3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609]

rPython を介して numpy をインポートすると (Python 3.5 で import numpy を使用しても問題はなく、すべて正常に動作します)、次のようになりました。

♥ python.exec('import numpy')
Error in python.exec("import numpy") :
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.

Original error was: /usr/local/lib/python3.5/dist-packages/numpy/core/multiarray.cpython-35m-x86_64-linux-gnu.so: undefined symbol: PyType_GenericNew

ただし、RPYTHON_PYTHON_VERSION=2 を設定して rPython を再インストールすると、numpy のインポートが機能します。Python 3.5を使用してrPythonでnumpyを正常にインポートするにはどうすればよいですか?

4

1 に答える 1