我的[R版本3.4.1是,Python版本3.5.2是,和操作系統是Ubuntu的16.04.2使用rPython進口numply與Python 3.5
我已經設置RPYTHON_PYTHON_VERSION = 3.5安裝rPython,當這是我的默認Python版本的rPython。
♥ 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使用進口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的作品。我怎樣才能成功導入numpy下的python 3.5 rPython?
謝謝Bartimus,我試過網狀(它是由Rstudio傢伙開發的,網狀蟒蛇是世界上最長的蛇),它可以用python 3.5導入numpy。並回答你的問題,是的,我可以導入一些其他的軟件包,例如pymongo,datetime和bson,除了python 3.5下的rPython下的numpy。我唯一關心的是將python3集成到R中,所以你真的幫助我,再次感謝。 –