本文介绍了手动安装pysam错误:"ImportError:没有名为版本的模块"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试手动安装pysam,因为我在没有Internet连接的集群上工作,并且我没有管理员权限(因此,我尝试通过conda进行操作是不可能的).我已经从开发人员的存储库( https://github下载所有压缩文件. com/pysam-developers/pysam/archive/master.zip ),然后将它们转移到群集中的目录中.

I am trying to install pysam manually as I am working on a cluster without internet connection and I do not have admin rights (thus doing it through conda is not possible, which I have tried). I have downloaded all the zipped files from the developer's repository (https://github.com/pysam-developers/pysam/archive/master.zip), then I transfer them to my directory in the cluster.

我已尝试通过运行从解压缩的存储库进行手动安装(如说明 https://github.com/pysam-developers/pysam/blob/master/INSTALL ):

I have tried the manual installation from the unzipped repository by running (as indicated in the instructions https://github.com/pysam-developers/pysam/blob/master/INSTALL):

python path/to/pysam-master/setup.py build

但是出现以下错误:

# pysam: cython is available - using cythonize if necessary
Traceback (most recent call last):
  File "path/to/pysam-master/setup.py", line 166, in <module>
    import version
ImportError: No module named version

setup.py文件中的第165、166和167行是:

Line 165, 166 and 167 in the setup.py file are:

165. sys.path.insert(0, "pysam")
 166. import version
 167.version = version.__version__

不幸的是,我的知识只带我走了这么远.是否有必要修改setup.py文件?

Unfortunatelly, my knowledge has taken me only this far. Is it necessary to modify the setup.py file?

我的系统规格:

  • Python 2.7.13 :: Anaconda,Inc.
  • CentOS 6.5版
  • Linux 2.6.32-431.20.5.el6.x86_64

推荐答案

version.py位于路径/至/pysam-master/pysam中.该脚本在导入之前使用os-module将pysam目录添加到环境的工作目录中.

version.py is in path/to/pysam-master/pysam. The script uses the os-module to add the pysam directory to the working directory of the environment before importing:

sys.path.insert(0, "pysam")

因此,应通过替换

sys.path.insert(0, "pysam")

包含pysam目录的完整路径.

with the full path to the pysam-directory.

这篇关于手动安装pysam错误:"ImportError:没有名为版本的模块"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-19 18:58