Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 根>;格架>;Ansible 2.4>;错误!意外异常,这可能是一个bug:没有名为six的模块_Python_Pip_Ansible - Fatal编程技术网

Python 根>;格架>;Ansible 2.4>;错误!意外异常,这可能是一个bug:没有名为six的模块

Python 根>;格架>;Ansible 2.4>;错误!意外异常,这可能是一个bug:没有名为six的模块,python,pip,ansible,Python,Pip,Ansible,上下文 我正在建立一个WordPress网站。它通过Vagrant、Ansible和VirtualBox在我的计算机上创建了一个虚拟机 问题 在安装过程中,我遇到了这个错误错误!意外异常,这可能是一个错误:没有名为six的模块 将Ansible降级到2.3(sudo-pip-install-Ansible==2.3.0.0)可以解决此错误,但我无法为较新的项目运行某些命令 代码示例 $ vagrant up Bringing machine 'default' up with 'virtua

上下文

我正在建立一个WordPress网站。它通过Vagrant、Ansible和VirtualBox在我的计算机上创建了一个虚拟机


问题

在安装过程中,我遇到了这个错误
错误!意外异常,这可能是一个错误:没有名为six的模块

将Ansible降级到2.3(
sudo-pip-install-Ansible==2.3.0.0
)可以解决此错误,但我无法为较新的项目运行某些命令


代码示例

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'bento/ubuntu-16.04'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/ubuntu-16.04' is up to date...
==> default: Setting the name of the VM: example.test
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: 
    default: Guest Additions Version: 5.0.26
    default: VirtualBox Version: 5.1
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Exporting NFS shared folders...
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
==> default: Mounting NFS shared folders...
==> default: Mounting shared folders...
    default: /vagrant => /home/myuser/Sites/example.com/trellis
==> default: Checking for bindfs in VM...
    default: Package manager detected: apt-get
    default: Fuse kernel module is installed
    default: Fuse kernel module is loaded
==> default: Bindfs seems to not be installed on the virtual machine, installing now
    default: Bindfs 1.12.6 is installed
==> default: Machine is ready to use bindfs!
==> default: Creating bind mounts after synced_folders...
    default: /vagrant-nfs-example.test => /srv/www/example.test/current
    default: /ansible-nfs => /home/vagrant/trellis
    default: /home/vagrant/trellis/bin => /home/vagrant/trellis/bin
==> default: [vagrant-hostmanager:guests] Updating hosts file on active guest virtual machines...
==> default: [vagrant-hostmanager:host] Updating hosts file on your workstation (password may be required)...
==> default: Running provisioner: ansible...
Vagrant has automatically selected the compatibility mode '2.0'
according to the Ansible version installed (2.4.0.0).

Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode

    default: Running ansible-galaxy...
- changing role composer from 1.5.0 to 1.5.0
- downloading role 'composer', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-composer/archive/1.5.0.tar.gz
- extracting composer to /home/myuser/Sites/example.com/trellis/vendor/roles/composer
- composer (1.5.0) was installed successfully
- changing role ntp from 1.3.0 to 1.3.0
- downloading role 'ntp', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-ntp/archive/1.3.0.tar.gz
- extracting ntp to /home/myuser/Sites/example.com/trellis/vendor/roles/ntp
- ntp (1.3.0) was installed successfully
- changing role logrotate from e7a498d to e7a498d
- downloading role 'logrotate', owned by nickhammond
- downloading role from https://github.com/nickhammond/ansible-logrotate/archive/e7a498d.tar.gz
- extracting logrotate to /home/myuser/Sites/example.com/trellis/vendor/roles/logrotate
- logrotate (e7a498d) was installed successfully
- changing role swapfile from 0.4 to 0.4
- downloading role 'swapfile', owned by kamaln7
- downloading role from https://github.com/kamaln7/ansible-swapfile/archive/0.4.tar.gz
- extracting swapfile to /home/myuser/Sites/example.com/trellis/vendor/roles/swapfile
- swapfile (0.4) was installed successfully
- changing role geerlingguy.daemonize from 1.1.1 to 1.1.1
- downloading role 'daemonize', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-daemonize/archive/1.1.1.tar.gz
- extracting geerlingguy.daemonize to /home/myuser/Sites/example.com/trellis/vendor/roles/geerlingguy.daemonize
- geerlingguy.daemonize (1.1.1) was installed successfully
- changing role mailhog from 2.1.0 to 2.1.0
- downloading role 'mailhog', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-mailhog/archive/2.1.0.tar.gz
- extracting mailhog to /home/myuser/Sites/example.com/trellis/vendor/roles/mailhog
- mailhog (2.1.0) was installed successfully
 [WARNING]: - dependency geerlingguy.daemonize from role mailhog differs from
already installed version (1.1.1), skipping

    default: Running ansible-playbook...
[DEPRECATION WARNING]: The use of 'include' for tasks has been deprecated. Use 
'import_tasks' for static inclusions or 'include_tasks' for dynamic inclusions.
 This feature will be removed in a future release. Deprecation warnings can be 
disabled by setting deprecation_warnings=False in ansible.cfg.
ERROR! Unexpected Exception, this is probably a bug: No module named six
to see the full traceback, use -vvv
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
myser@ubuntu:~/Sites/example.com/trellis$ sudo pip install --ignore-installed six
The directory '/home/myuser/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/myuser/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting six
  Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Installing collected packages: six
Successfully installed six-1.11.0
myuser@ubuntu:~/Sites/example.com/trellis$ sudo -H pip install --ignore-installed six
Collecting six
  Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Installing collected packages: six
Successfully installed six-1.11.0
调试 -我的Ubuntu 17.10机器上安装了Ansible 2.3.x。 -
哪个pip
导致
/usr/local/bin/pip
-
哪条python
导致了
/usr/bin/python
-
pip--version
从/usr/local/lib/python2.7/dist-packages/pip(python2.7)生成
PIP10.0.1
-
python--version
产生了
python2.7.14

尝试的解决方案

我读过官方Ansible存储库,但没有解决方案。而且,这不是一个合适的解决方案,我很确定它在我的情况下不会起作用,因为它与根堆栈是如此的完整

  • 我尝试了
    sudo easy\u install pip
    ,它成功地执行了,但没有解决问题
  • 我检查了一下,据我所知,只有一次安装
  • 使用
    sudo-H pip安装六个--升级
    • 我还尝试了
      python-mpip安装六个
      ,这导致
      需求已经得到满足:六个in/usr/local/lib/python2.7/dist-packages(1.11.0)
  • 这基本上是一个重复的问题。原来如此。和。啊
  • 大多数,这和这是直接从根网格论坛,但他们没有介绍任何新的解决方案比我归结为上面
这是一个

有三种解决办法:

  • sudo pip install ansible==2.3.0.0
    或使用自制
    brew search
    查看可用版本,然后
    brew安装ansible@2.0
    brew链接--强制ansible@2.0
    )在项目之间切换时