简体   繁体   English

xlrd,xlwt和sagemath

[英]xlrd, xlwt with sagemath

I want to use xlrd, xlwt, xlutils with sagemath. 我想使用xlrd,xlwt,xlutils和sagemath。 I have installed them in my system's Python(2.7.3) but sage environment is not recognizing them. 我已将它们安装在我的系统的Python(2.7.3)中,但sage环境无法识别它们。 Getting following error when I try to import with sage 当我尝试使用sage导入时出现以下错误

ImportError: No module named xlrd`

But without sage its working fine. 但没有圣人它的工作正常。 Any idea how can I make them work inside sage?? 任何想法如何让他们在圣人里面工作? I am using Ubuntu 12(quantal),32 bits and Sage Version 5.8 with Python 2.7.5(sage's Python). 我正在使用Ubuntu 12(量子),32位和Sage版本5.8与Python 2.7.5(鼠尾草的Python)。

Faced same problem with Tkinter too but solved it using sudo apt-get install tk8.5-dev got solution form http://www.sagemath.org/doc/faq/faq-usage.html#how-to-get-sage-s-python-to-recognize-my-system-s-tcl-tk-install 面对与Tkinter相同的问题,但使用sudo apt-get install tk8.5-dev解决了它解决方案形式http://www.sagemath.org/doc/faq/faq-usage.html#how-to-get-sage -s-蟒蛇到承认,我的系统-S-TCL-TK-安装

But what for other libraries? 但是其他图书馆呢?

I tried to install them manually inside /usr/lib/sagemath/local/lib/python2.7/site-packages/ folder by putting tar files then extract them and then sudo python setup.py install but still not working. 我尝试在/usr/lib/sagemath/local/lib/python2.7/site-packages/文件夹中手动安装它们,然后放入tar文件,然后解压缩,然后sudo python setup.py install但仍然无法正常工作。

Rather than installing them with the system Python, install them with Sage's Python: you can either do sage --sh : this starts a subshell with various environment variables set appropriately for use with Sage, in particular $PATH will have $SAGE_ROOT/local/bin first. 不是用系统Python安装它们,而是用Sage的Python安装它们:你可以使用sage --sh :这会启动一个子shell,其中各种环境变量设置适当与Sage一起使用,特别是$PATH将有$SAGE_ROOT/local/bin Then install the packages with python setup.py install etc. Or you can just run Sage's Python directly with sage --python setup.py install ... . 然后使用python setup.py install等安装软件包。或者你可以直接使用sage --python setup.py install ...运行Sage的Python。

Sage does not use the python installed in your system. Sage不使用系统中安装的python。 It uses its own copy of python so while working with sage programs you would have to run the programs from terminal using this command 它使用自己的python副本,因此在使用sage程序时,您必须使用此命令从终端运行程序

$ sage --python <Python_File>

Similarly sage does not uses the modules installed in the system's python. 同样,sage不使用系统python中安装的模块。 The Modules need to be installed under sage libraries. 模块需要安装在sage库下。 You have downloaded and extracted the folder right but used a wrong command. 您已经下载并解压缩了该文件夹但使用了错误的命令。 Now go again in the xlrd extracted folder and use this command. 现在再次进入xlrd提取的文件夹并使用此命令。

$ sage --python setup.py install 

Now Everything should work. 现在一切都应该有效。

Cheers 干杯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM