ubuntu18安装python接口的openslide过程和错误整理

配置

版本
python 3.6.10
pip 20.1

安装过程

pip直接安装

pip install openslide-python

出现问题:

ERROR: Command errored out with exit status 1:
     command: /media/s2/cyq/anaconda3/envs/keras/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kpd80yg0/openslide-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kpd80yg0/openslide-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-86l6dxk_
         cwd: /tmp/pip-install-kpd80yg0/openslide-python/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-kpd80yg0/openslide-python/setup.py", line 2, in <module>
        from setuptools import setup, Extension, Feature
    ImportError: cannot import name 'Feature'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

安装openslide依赖:

sudo apt install python-opendslide

还是一样的问题

试了几种办法都不管用(包括升级python版本,重新搭一个虚拟环境等),最后选择用tar.gz安装

openslide下载网址:OpenSlide
OpenSlide打开界面
选择python接口下载,我选择的最新版本1.1.1
openslide python接口上传到集群,解压:
tar -xzvf openslide-python-1.1.1.tar.gz
进入文件夹:
cd openslide-python-1.1.1/
安装:
python setup.py install --single-version-externally-managed --record /dev/null
出现错误:

Traceback (most recent call last):
  File "setup.py", line 2, in <module>
    from setuptools import setup, Extension, Feature
ImportError: cannot import name 'Feature' from 'setuptools' (/media/s2/cyq/anaconda3/envs/test/lib/python3.8/site-packages/setuptools/__init__.py)

解决办法:降低setuptools版本(原来是46.3.1)
pip install setuptools==45
再次安装:
python setup.py install --single-version-externally-managed --record /dev/null
出现信息:

……
running install_egg_info
running egg_info
writing openslide_python.egg-info/PKG-INFO
writing dependency_links to openslide_python.egg-info/dependency_links.txt
writing requirements to openslide_python.egg-info/requires.txt
writing top-level names to openslide_python.egg-info/top_level.txt
reading manifest file 'openslide_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'openslide_python.egg-info/SOURCES.txt'
Copying openslide_python.egg-info to /media/s2/cyq/anaconda3/envs/test/lib/python3.8/site-packages/openslide_python-1.1.1-py3.8.egg-info
running install_scripts
writing list of installed files to '/dev/null'

测试,结果报错:

(test) cyq@node5-SYS-4029GP-TRT:~/openslide-python-1.1.1$ python
Python 3.8.2 | packaged by conda-forge | (default, Apr 24 2020, 08:20:52) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import openslide
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/media/s2/cyq/openslide-python-1.1.1/openslide/__init__.py", line 29, in <module>
    from openslide import lowlevel
  File "/media/s2/cyq/openslide-python-1.1.1/openslide/lowlevel.py", line 58, in <module>
    _lib = cdll.LoadLibrary('libopenslide.so.0')
  File "/media/s2/cyq/anaconda3/envs/test/lib/python3.8/ctypes/__init__.py", line 451, in LoadLibrary
    return self._dlltype(name)
  File "/media/s2/cyq/anaconda3/envs/test/lib/python3.8/ctypes/__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libopenslide.so.0: cannot open shared object file: No such file or directory
>>> 

上网查了说是缺少依赖,需要安装:
sudo apt-get install openslide-tools
报错:

root@node5-SYS-4029GP-TRT:~# sudo apt-get install openslide-tools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libopenjp2-7 libopenslide0
Suggested packages:
  libtiff-tools
The following NEW packages will be installed:
  libopenjp2-7 libopenslide0 openslide-tools
0 upgraded
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值