gpt4 book ai didi

python - 没有名为 sh 的模块

转载 作者:行者123 更新时间:2023-12-03 22:31:02 27 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





Not able to install Python packages [SSL: TLSV1_ALERT_PROTOCOL_VERSION]

(17 个回答)


3年前关闭。




我安装了sh对于 native python,我开始使用命令安装:

$ pip install sh
Collecting sh
Could not fetch URL https://pypi.python.org/simple/sh/: There was a problem confirming the ssl
certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
Could not find a version that satisfies the requirement sh (from versions: )
No matching distribution found for sh

以上失败时,我下载 sh-1.12.14-py2.py3-none-any.whl在本地安装:
$ pip install
/Users/zhangkuixun/Downloads/sh-1.12.14-py2.py3-none-any.whl
Requirement
'/Users/zhangkuixun/Downloads/sh-1.12.14-py2.py3-none-any.whl' looks
like a filename, but the file does not exist
Processing ./Downloads/sh-1.12.14-py2.py3-none-any.whl
Exception:

Traceback (most recent call last):
File
"/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/basecommand.py",
line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/commands/install.py",
line 299, in run
requirement_set.prepare_files(finder) File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_set.py", line 370, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_set.py",
line 587, in _prepare_file<br/>
session=self.session, hashes=hashes) File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/download.py",
line 798, in unpack_url
unpack_file_url(link, location, download_dir, hashes=hashes)
File
"/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/download.py",
line 705, in unpack_file_url
unpack_file(from_path, location, content_type, link)
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/utils/__init__.py",
line 599, in unpack_file
flatten=not filename.endswith('.whl')
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/utils/__init__.py",
line 482, in unzip_file
zipfp = open(filename, 'rb')
IOError: [Errno 2] No such file or directory:
'/Users/zhangkuixun/Downloads/sh-1.12.14-py2.py3-none-any.whl'

这条路是对的。它确实存在:
$ cd /Users/zhangkuixun/Downloads/
$ ls
...
sh-1.12.14-py2.py3-none-any.whl

如何安装 SH 并引用它?现在引用失败:
$ python
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sh
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named sh
>>>

最佳答案

解决了:

1.到这里https://pypi.org/project/sh/#files下载sh-1...14.tar.gz
2.执行命令:sudo easy_install /YourPath/sh-1.12.14.tar.gz

yihuyang:~ zhangkuixun$ python 
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sh
>>>

坦克@Charles Duffy

关于python - 没有名为 sh 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53843623/

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