gpt4 book ai didi

python - 导入错误 : No module named attr

转载 作者:行者123 更新时间:2023-12-03 16:28:51 30 4
gpt4 key购买 nike

我在 Python 方面只有非常基本的经验。我正在尝试安装软件包 pyslim (见 here on the pypi website)。我做了

$ pip install pyslim

Requirement already satisfied: pyslim in ./Library/Python/2.7/lib/python/site-packages/pyslim-0.1-py2.7.egg (0.1)
Requirement already satisfied: msprime in /usr/local/lib/python2.7/site-packages (from pyslim) (0.6.1)
Requirement already satisfied: attrs in /usr/local/lib/python2.7/site-packages (from pyslim) (16.3.0)
Requirement already satisfied: svgwrite in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (1.1.12)
Requirement already satisfied: jsonschema in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (2.6.0)
Requirement already satisfied: six in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (1.10.0)
Requirement already satisfied: numpy>=1.7.0 in /usr/local/lib/python2.7/site-packages/numpy-1.10.4-py2.7-macosx-10.11-x86_64.egg (from msprime->pyslim) (1.10.4)
Requirement already satisfied: h5py in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (2.8.0)
Requirement already satisfied: pyparsing>=2.0.1 in /usr/local/lib/python2.7/site-packages (from svgwrite->msprime->pyslim) (2.2.0)
Requirement already satisfied: functools32; python_version == "2.7" in /usr/local/lib/python2.7/site-packages (from jsonschema->msprime->pyslim) (3.2.3.post2)

但是当我打开 python 并尝试导入时 pyslim , 它失败
> import pyslim

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/remi/Library/Python/2.7/lib/python/site-packages/pyslim-0.1-py2.7.egg/pyslim/__init__.py", line 4, in <module>
from pyslim.slim_metadata import * # NOQA
File "/Users/remi/Library/Python/2.7/lib/python/site-packages/pyslim-0.1-py2.7.egg/pyslim/slim_metadata.py", line 1, in <module>
import attr
ImportError: No module named attr

所以我做了
$ pip install attr
Requirement already satisfied: attr in /usr/local/lib/python2.7/site-packages (0.3.1)


$ pip install attrs
Requirement already satisfied: attrs in /usr/local/lib/python2.7/site-packages (16.3.0)

我重新启动了 python 并尝试导入 pyslim再次,但我不断收到相同的错误消息。我还尝试通过执行以下操作从 github 下载并安装文件
$ git clone https://github.com/tskit-dev/pyslim.git
$ cd pyslim
$ python setup.py install --user

如所示 here on the pypi website .在最后一行代码中,我得到一个长输出
Download error on https://pypi.python.org/simple/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) -- Some packages may not be found!
No local packages or download links found for attrs
error: Could not find suitable distribution for Requirement.parse('attrs')

我正在使用 Python 2.7.10MAC OSX 10.11.6 .不确定是否重要,但我通常使用自制软件安装东西。我正在使用 pip 18.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7) .

编辑
$ which python
/usr/bin/python
$ which pip
/usr/local/bin/pip

最佳答案

首先卸载pyslim。使用“pip卸载pyslim”。然后尝试使用再次安装
“conda install -c conda-forge pyslim”
引用 https://anaconda.org/conda-forge/pyslim

关于python - 导入错误 : No module named attr,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52729841/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com