提问者:小点点

尝试在Mac上更新Anable


我正在尝试从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

但仍然没有答案。你知道我错过了什么吗?


共1个答案

匿名用户

在macOS上,pip在~/Library/Python中安装“用户”软件包/

简单的解决方法是:

export PATH=`python3 -m site --user-base`/bin:$PATH

在这个问题中给出了更多的细节:pip成功安装包,但是在命令行中找不到可执行文件