gpt4 book ai didi

python - 尝试导入 'ruamel.yaml' 库导致 'ImportError: No module named ruamel.yaml' 错误

转载 作者:太空宇宙 更新时间:2023-11-04 04:36:30 28 4
gpt4 key购买 nike

我跑了一个

pip install ruamel.yaml

当我尝试做的时候

import ruamel.yaml

我得到一个错误:

ImportError: No module named ruamel.yaml

python 2.7,

我的 pip 'freeze' 的输出:

nose==1.3.7
numpy==1.12.1
pandas==0.23.3
python-dateutil==2.7.3
pytz==2018.5
PyYAML==3.13
ruamel.ordereddict==0.4.13
ruamel.yaml==0.15.46
six==1.11.0

最佳答案

Linux (Solus):

$ uname 
Linux
$ virtualenv -p /opt/python/2.7/bin/python /var/tmp/so_51581941
Running virtualenv with interpreter /opt/python/2.7/bin/python
New python executable in /var/tmp/so_51581941/bin/python
Installing setuptools, pip, wheel...done.
$ source /var/tmp/so_51581941/bin/activate
(so_51581941) $ pip install ruamel.yaml
Collecting ruamel.yaml
Downloading https://files.pythonhosted.org/packages/b1/30/3d5c9bc3955136027177a7bbe4cf9ec94504d8cba851ce391eb2e9633db5/ruamel.yaml-0.15.46-cp27-cp27mu-manylinux1_x86_64.whl (592kB)
100% |████████████████████████████████| 593kB 2.9MB/s
Collecting ruamel.ordereddict; platform_python_implementation == "CPython" and python_version <= "2.7" (from ruamel.yaml)
Downloading https://files.pythonhosted.org/packages/f3/2c/fa6d75dc459b371ed3b88fdbf8042785ce1655073c884fd97bdbb9f48e01/ruamel.ordereddict-0.4.13-cp27-cp27mu-manylinux1_x86_64.whl (99kB)
100% |████████████████████████████████| 102kB 3.8MB/s
Installing collected packages: ruamel.ordereddict, ruamel.yaml
Successfully installed ruamel.ordereddict-0.4.13 ruamel.yaml-0.15.46
(so_51581941) $ pip freeze
ruamel.ordereddict==0.4.13
ruamel.yaml==0.15.46
(so_51581941) $ python -c "import ruamel.yaml"
(so_51581941) $ deactivate
$

苹果操作系统:

$ uname
Darwin
$ which python2.7
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
$ virtualenv -p /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /var/tmp/so_51581941
Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
New python executable in /var/tmp/so_51581941/bin/python
Installing setuptools, pip, wheel...done.
$ source /var/tmp/so_51581941/bin/activate
(so_51581941) $ pip install ruamel.yaml
Collecting ruamel.yaml
Downloading https://files.pythonhosted.org/packages/cd/0e/0e21d703e775f94447d6889ec231309679cb684347868b4b1e73e08510fd/ruamel.yaml-0.15.46-cp27-cp27m-macosx_10_9_x86_64.whl (236kB)
100% |████████████████████████████████| 245kB 3.5MB/s
Collecting ruamel.ordereddict; platform_python_implementation == "CPython" and python_version <= "2.7" (from ruamel.yaml)
Downloading https://files.pythonhosted.org/packages/b1/8f/3b1b407ff387e006a4a33e62182b212077bed41676451d60327955a50c3c/ruamel.ordereddict-0.4.13.tar.gz (57kB)
100% |████████████████████████████████| 61kB 3.6MB/s
Building wheels for collected packages: ruamel.ordereddict
Running setup.py bdist_wheel for ruamel.ordereddict ... done
Stored in directory: /Users/builder/Library/Caches/pip/wheels/5e/76/38/d2f83b281e02aa1bac95b2663ea19ed022440033b61e47ac3a
Successfully built ruamel.ordereddict
Installing collected packages: ruamel.ordereddict, ruamel.yaml
Successfully installed ruamel.ordereddict-0.4.13 ruamel.yaml-0.15.46
(so_51581941) $ pip freeze
ruamel.ordereddict==0.4.13
ruamel.yaml==0.15.46
(so_51581941) $ python -c "import ruamel.yaml"
(so_51581941) $ deactivate
$

window :

$ python -c "import sys; print(sys.platform)"
win32

$ virtualenv -p c:\Python\2.7\python.exe %TMP%\so_51581941
Running virtualenv with interpreter c:\Python\2.7\python.exe
New python executable in C:\Users\Anthon\AppData\Local\Temp\so_51581941\Scripts\
python.exe
Installing setuptools, pip, wheel...done.

$ %TMP%\so_51581941\Scripts\activate

(so_51581941) $ pip install ruamel.yaml
Collecting ruamel.yaml
Downloading https://files.pythonhosted.org/packages/70/79/337d043310c8b9fe7978a9ab72b7838b8088785a66a69cb6558771a19969/ruamel.yaml-0.15.46-cp27-cp27m-win_amd64.whl (208kB)
100% |################################| 215kB 1.7MB/s
Collecting ruamel.ordereddict; platform_python_implementation == "CPython" and python_version <= "2.7" (from ruamel.yaml)
Downloading https://files.pythonhosted.org/packages/2b/d4/b1ec24d4cc8669bb01e303573a5dd9a85b4c116a53c225749fbb9bce0ac9/ruamel.ordereddict-0.4.13-cp27-cp27m-win_amd64.whl
Installing collected packages: ruamel.ordereddict, ruamel.yaml
Successfully installed ruamel.ordereddict-0.4.13 ruamel.yaml-0.15.46

(so_51581941) $ pip freeze
ruamel.ordereddict==0.4.13
ruamel.yaml==0.15.46

(so_51581941) $ python -c "import ruamel.yaml"

(so_51581941) $ deactivate
$

(来自 commmand.comset prompt=$$)

关于python - 尝试导入 'ruamel.yaml' 库导致 'ImportError: No module named ruamel.yaml' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51581941/

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