我是UBUNTU(Python 2.7用户)的新手,在安装python的xraylib
库时遇到了一个奇怪的问题。任何官方存储库中都没有提供该库,唯一可能的安装方法是解压缩它的*tar.gz
'文件。
我做了什么:
1)我下载了' tar.gz
'提交给' /Downloads
'夹
2)执行以下命令:
gunzip xraylib-version.tar.gz
tar xvf xraylib-version.tar
cd xraylib-version
./configure
sudo make install
我发现该软件包已经安装在' usr/local/include
'文件夹(不在默认usr/lib/python2.7
中)。因此,在Spyder中,我将此文件夹添加到PYTHONPATH
变量中,在写完' import xraylib
'后,我收到了消息:
"No module named xraylib"
此外,我发现无法将xraylib
文件夹拖到存储所有python包的usr/lib/python2.7
。
任何人都可以解释从#34; tar.gz
"安装python模块的最佳,最简单的方法。文件,以便包可以在默认的python包文件夹中结束?
答案 0 :(得分:1)
非常感谢您的回答!
我试过这种方式,但我发现它失败了。
1)我跑了这个"卷曲......"命令
2)我去了../etc/apt/sources.list.d/文件夹,在那里我通过添加(并保存)这些行来编辑sources.list文件:
' deb [arch = amd64] http://lvserver.ugent.be/apt/ubuntu xenial stable
deb-src http://lvserver.ugent.be/apt/ubuntu xenial stable'
3)我跑了'sudo apt-get update'
4)最后,写完之后(我使用UBUNTU 16.04): ' sudo apt-get install libxrl7 xraylib libxrl7-dev libxrlf03-7 libxrl-perl'
我得到了:
'阅读包裹清单......完成
构建依赖关系树
阅读州信息......完成
E:无法找到包libxrl7
E:无法找到包xraylib
E:无法找到包libxrl7-dev
E:无法找到包libxrlf03-7
E:无法找到包libxrl-perl'
意思是,我的系统仍无法找到源。
答案 1 :(得分:0)
https://github.com/tschoonj/xraylib/wiki/Installation-instructions#debian-and-ubuntu
指示非常明确curl http://lvserver.ugent.be/apt/xmi.packages.key | sudo apt-key add -
Next, add the package download location corresponding to your distribution to the /etc/apt/sources.list file (as root):
Ubuntu Precise 12.04:
deb [arch=amd64] http://lvserver.ugent.be/apt/ubuntu precise stable
deb-src http://lvserver.ugent.be/apt/ubuntu precise stable
Ubuntu Trusty 14.04:
deb [arch=amd64] http://lvserver.ugent.be/apt/ubuntu trusty stable
deb-src http://lvserver.ugent.be/apt/ubuntu trusty stable
Ubuntu Wily 15.10:
deb [arch=amd64] http://lvserver.ugent.be/apt/ubuntu wily stable
deb-src http://lvserver.ugent.be/apt/ubuntu wily stable
Ubuntu Xenial 16.04:
deb [arch=amd64] http://lvserver.ugent.be/apt/ubuntu xenial stable
deb-src http://lvserver.ugent.be/apt/ubuntu xenial stable
When the sources.list file contains the correct download locations, update the apt cache by running:
sudo apt-get update
After this, one can install xraylib by executing the following command:
sudo apt-get install libxrl7 xraylib libxrl7-dev libxrlf03-7 libxrl-perl