python – 如何克服 – 在windows上使用文件名或扩展名失败的pip install ansible

python – 如何克服 – 在windows上使用文件名或扩展名失败的pip install ansible,第1张

概述如何修复 Windows上的pip安装失败,错误如下.尝试安装ansible时出现此错误. 我怀疑选择的pip包安装问题.但同样适用于基于Linux的系统. pip安装的 *** 作系统是否会有任何差异 Exception:Traceback (most recent call last): File "c:\python27\lib\site-packages\pip\basecommand.py 如何修复 Windows上的pip安装失败,错误如下.尝试安装ansible时出现此错误.

我怀疑选择的pip包安装问题.但同样适用于基于Linux的系统. pip安装的 *** 作系统是否会有任何差异

Exception:Traceback (most recent call last):  file "c:\python27\lib\site-packages\pip\basecommand.py",line 215,in main    status = self.run(options,args)  file "c:\python27\lib\site-packages\pip\commands\install.py",line 324,in run    requirement_set.prepare_files(finder)  file "c:\python27\lib\site-packages\pip\req\req_set.py",line 380,in prepare_files    ignore_dependencIEs=self.ignore_dependencIEs))  file "c:\python27\lib\site-packages\pip\req\req_set.py",line 620,in _prepare_file    session=self.session,hashes=hashes)  file "c:\python27\lib\site-packages\pip\download.py",line 821,in unpack_url    hashes=hashes  file "c:\python27\lib\site-packages\pip\download.py",line 663,in unpack_http_url    unpack_file(from_path,location,content_type,link)  file "c:\python27\lib\site-packages\pip\utils\__init__.py",line 605,in unpack_file    untar_file(filename,location)  file "c:\python27\lib\site-packages\pip\utils\__init__.py",line 553,in untar_file    ensure_dir(path)  file "c:\python27\lib\site-packages\pip\utils\__init__.py",line 83,in ensure_dir    os.makedirs(path)  file "C:\Python27\lib\os.py",line 157,in makedirs    mkdir(name,mode)windowsError: [Error 206] The filename or extension is too long: 'c:\users\user123\appdata\local\temp\pip-build-isnb2t\ansible\test/integration/targets/copy/files/subdir/subdir1/circles/subdir1/circles/subdir1/circles/subdir1/circles/subdir1/circles/subdir1/circles/subdir1/circles/subdir1/circles/subdir1/circles/subdir1/'
解决方法 好吧,这似乎是一个已知的错误:

https://github.com/ansible/ansible/issues/31419

In Ansible 2.4.0,the module copy use symbolic links in the tests suite: 07001

circles -> ../subdir3 -> ../subdir2/subdir3

windows 10无法创建此目录树,因为路径太长.实际上解决的路径是:

test/integration/targets/copy/files/subdir/subdir1/circles/subdir1/circles/subdir1/circles/subdir1/circles/subdir1/circles/subdir1/circles/subdir1/circles/subdir1/circles/subdir2/subdir3/

错误报告以:

We do not support installing ansible directly on a windows machine. You will need a linux like operating system to install ansible on

解决方法

一个可能的解决方法是在pypi上下载轮,它不依赖于linux或其他什么,可能是纯python:

https://pypi.python.org/pypi/ansible/2.5.0a

(pip install ansible命令下载“source”.tgz archive,执行测试,…并且路径问题在测试中,所以让我们使用一个现成的预构建的bundle)

下载后,使用pip install path / to / the / wheel / file.whl

在我的windows 10计算机上成功测试并安装:

C:\Users\jotd>c:\Python27\Scripts\pip install C:\Users\jotd\Downloads\ansible-2.5.0a1-py2-none-any.whlProcessing c:\users\jotd\downloads\ansible-2.5.0a1-py2-none-any.whlRequirement already satisfIEd: PyYAML in c:\python27\lib\site-packages (from ansible==2.5.0a1)Collecting cryptography (from ansible==2.5.0a1)<a lot of package collecting...>Installing collected packages: IDna,pycparser,cffi,asn1crypto,ipaddress,cryptography,pynacl,bcrypt,pyasn1,paramiko,ansible  Running setup.py install for pycparser ... done  Running setup.py install for ipaddress ... doneSuccessfully installed ansible-2.5.0a1 asn1crypto-0.24.0 bcrypt-3.1.4 cffi-1.11.4 cryptography-2.1.4 IDna-2.6 ipaddress-1.0.19 paramiko-2.4.0 pyasn1-0.4.2 pycparser-2.18 pynacl-1.2.1

好的,已安装,但让我们尝试导入它:

C:\Users\jotd>c:\python27\pythonPython 2.7.12 (v2.7.12:d33e0cf91556,Jun 27 2016,15:24:40) [MSC v.1500 64 bit (AMD64)] on win32Type "help","copyright","credits" or "license" for more information.>>> import ansible>>>

作品!好极了!

总结

以上是内存溢出为你收集整理的python – 如何克服 – 在windows上使用文件名扩展名失败的pip install ansible全部内容,希望文章能够帮你解决python – 如何克服 – 在windows上使用文件名或扩展名失败的pip install ansible所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1207067.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-04
下一篇 2022-06-04

发表评论

登录后才能评论

评论列表(0条)

保存