python-2.7 - 尝试在 Mac 上更新 Ansible
问题描述
我正在尝试从 Ansible 2.9.2 升级到 2.10。我知道需要删除当前的 ansible,我相信我在这方面取得了成功。文档中有几个不同的命令行(使用 pip 安装 Ansible)。似乎没有错误的那个使用了python3,并产生了......
sol:ansible sjf$ which python3
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3
sol:ansible sjf$ python3 -m pip install --user ansible
Collecting ansible
Using cached https://files.pythonhosted.org/packages/bb/09/dc8dee3f123166990bb4ca281001818fd552b4b5da56fa5cff2b47a0a0b4/ansible-2.10.1.tar.gz
Collecting ansible-base<2.11,>=2.10.2 (from ansible)
Using cached https://files.pythonhosted.org/packages/b3/7f/2a3d935534b5b41fbde5a9fab03c3fdc7c5f94c113409ec1031ddc9bc8de/ansible-base-2.10.2.tar.gz
Collecting jinja2 (from ansible-base<2.11,>=2.10.2->ansible)
Downloading https://files.pythonhosted.org/packages/30/9e/f663a2aa66a09d838042ae1a2c5659828bb9b41ea3a6efa20a20fd92b121/Jinja2-2.11.2-py2.py3-none-any.whl (125kB)
|████████████████████████████████| 133kB 2.2MB/s
Collecting PyYAML (from ansible-base<2.11,>=2.10.2->ansible)
Downloading https://files.pythonhosted.org/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz (269kB)
|████████████████████████████████| 276kB 18.3MB/s
Collecting cryptography (from ansible-base<2.11,>=2.10.2->ansible)
Downloading https://files.pythonhosted.org/packages/d3/48/99888a2c33a8addbb6c6dfeeb440425b9fbfa77cc37729d4dfde89cf0245/cryptography-3.1.1-cp35-abi3-macosx_10_10_x86_64.whl (1.8MB)
|████████████████████████████████| 1.8MB 16.9MB/s
Collecting packaging (from ansible-base<2.11,>=2.10.2->ansible)
Using cached https://files.pythonhosted.org/packages/46/19/c5ab91b1b05cfe63cccd5cfc971db9214c6dd6ced54e33c30d5af1d2bc43/packaging-20.4-py2.py3-none-any.whl
Collecting MarkupSafe>=0.23 (from jinja2->ansible-base<2.11,>=2.10.2->ansible)
Downloading https://files.pythonhosted.org/packages/0c/12/37f68957526d1ec0883b521934b4e1b8ff3dd8e4fab858a5bf3e487bcee9/MarkupSafe-1.1.1-cp38-cp38-macosx_10_9_x86_64.whl
Collecting six>=1.4.1 (from cryptography->ansible-base<2.11,>=2.10.2->ansible)
Downloading https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Collecting cffi!=1.11.3,>=1.8 (from cryptography->ansible-base<2.11,>=2.10.2->ansible)
Downloading https://files.pythonhosted.org/packages/74/9d/bfa10946bcae5d9b922fbdc244d94e89e5b5be3f7539950bc1dc43a89b6b/cffi-1.14.3-2-cp38-cp38-macosx_10_9_x86_64.whl (176kB)
|████████████████████████████████| 184kB 4.5MB/s
Collecting pyparsing>=2.0.2 (from packaging->ansible-base<2.11,>=2.10.2->ansible)
Using cached https://files.pythonhosted.org/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography->ansible-base<2.11,>=2.10.2->ansible)
Downloading https://files.pythonhosted.org/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl (112kB)
|████████████████████████████████| 112kB 7.6MB/s
Installing collected packages: MarkupSafe, jinja2, PyYAML, six, pycparser, cffi, cryptography, pyparsing, packaging, ansible-base, ansible
Running setup.py install for PyYAML ... done
Running setup.py install for ansible-base ... done
Running setup.py install for ansible ... done
Successfully installed MarkupSafe-1.1.1 PyYAML-5.3.1 ansible-2.10.1 ansible-base-2.10.2 cffi-1.14.3 cryptography-3.1.1 jinja2-2.11.2 packaging-20.4 pycparser-2.20 pyparsing-2.4.7 six-1.15.0
WARNING: You are using pip version 19.2.3, however version 20.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
但是 'which ansible' 没有输出,没有找到 'ansible --version' 命令。
使用原始 python (2.7.16) 产生...
sol:ansible sjf$ python -m pip install --user ansible
WARNING: Executing a script that is loading libcrypto in an unsafe way. This will fail in a future version of macOS. Set the LIBRESSL_REDIRECT_STUB_ABORT=1 in the environment to force this into an error.
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting ansible
Collecting ansible-base<2.11,>=2.10.2 (from ansible)
Collecting packaging (from ansible-base<2.11,>=2.10.2->ansible)
Using cached https://files.pythonhosted.org/packages/46/19/c5ab91b1b05cfe63cccd5cfc971db9214c6dd6ced54e33c30d5af1d2bc43/packaging-20.4-py2.py3-none-any.whl
Requirement already satisfied: cryptography in /Library/Python/2.7/site-packages (from ansible-base<2.11,>=2.10.2->ansible) (2.6.1)
Requirement already satisfied: jinja2 in /Library/Python/2.7/site-packages (from ansible-base<2.11,>=2.10.2->ansible) (2.10)
Requirement already satisfied: PyYAML in /Library/Python/2.7/site-packages (from ansible-base<2.11,>=2.10.2->ansible) (5.1)
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from packaging->ansible-base<2.11,>=2.10.2->ansible) (1.12.0)
Collecting pyparsing>=2.0.2 (from packaging->ansible-base<2.11,>=2.10.2->ansible)
Using cached https://files.pythonhosted.org/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl
Requirement already satisfied: enum34; python_version < "3" in /Library/Python/2.7/site-packages (from cryptography->ansible-base<2.11,>=2.10.2->ansible) (1.1.6)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in /Library/Python/2.7/site-packages (from cryptography->ansible-base<2.11,>=2.10.2->ansible) (1.12.2)
Requirement already satisfied: asn1crypto>=0.21.0 in /Library/Python/2.7/site-packages (from cryptography->ansible-base<2.11,>=2.10.2->ansible) (0.24.0)
Requirement already satisfied: ipaddress; python_version < "3" in /Library/Python/2.7/site-packages (from cryptography->ansible-base<2.11,>=2.10.2->ansible) (1.0.22)
Requirement already satisfied: MarkupSafe>=0.23 in /Library/Python/2.7/site-packages (from jinja2->ansible-base<2.11,>=2.10.2->ansible) (1.1.1)
Requirement already satisfied: pycparser in /Library/Python/2.7/site-packages (from cffi!=1.11.3,>=1.8->cryptography->ansible-base<2.11,>=2.10.2->ansible) (2.19)
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
Installing collected packages: pyparsing, packaging, ansible-base, ansible
Successfully installed ansible-2.10.1 ansible-base-2.10.2 packaging-20.4 pyparsing-2.4.7
但仍然没有ansible。有什么我想念的想法吗?
解决方案
在 macOS 上,在~/Library/Python/<version>
. 对你来说,大概是~/Library/Python/3.8
。您需要将子目录添加bin
到您的路径中。
简单的解决方法是:
export PATH=`python3 -m site --user-base`/bin:$PATH
这个问题给出了更多细节: pip installs packages successful, but executables not found from command line
推荐阅读
- javascript - Chrome浏览器禁用了flash插件,导致我使用jwplayer插件提示“找不到合适的播放器!”。我怎么解决这个问题?
- netflix-feign - 调用 netflix FeignClient 时未保留 Trace Id
- node.js - 如何在没有 express 的情况下使用 Multer
- nlp - Ruta 中的字符串连接
- django - 无论输入如何,Django ModelChoiceField 查询集都会返回相同的结果
- c# - 如何在注册页面 C# MVC 上使用 Cosmos DB 数据填充下拉值?
- typescript - 为什么我不能从已经省略的类型中省略属性?
- ios - 通用链接在 iOS 12.2、12.3 中不起作用
- jquery - 使用 JQuery AJAX 将无序列表项传递给 ASP.net MVC 控制器操作方法
- java - 当我只打开机顶盒时,Android WebView 的时间太慢了