是否可以下载最新版本的 .whl
文件?
例如,首先,我们尝试用pip下载一些特定版本的 enum34
pip download enum34-1.1.10-py2-none-any.whl
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
WARNING: Requirement 'enum34-1.1.10-py2-none-any.whl' looks like a filename, but the file does not exist
Processing ./enum34-1.1.10-py2-none-any.whl
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 188, in _main
status = self.run(options, args)
File "/usr/lib/python2.7/site-packages/pip/_internal/cli/req_command.py", line 185, in wrapper
return func(self, options, args)
File "/usr/lib/python2.7/site-packages/pip/_internal/commands/download.py", line 132, in run
reqs, check_supported_wheels=True
File "/usr/lib/python2.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 179, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "/usr/lib/python2.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 362, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/usr/lib/python2.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 314, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(req)
File "/usr/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 469, in prepare_linked_requirement
hashes=hashes,
File "/usr/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 264, in unpack_url
unpack_file(file.path, location, file.content_type)
File "/usr/lib/python2.7/site-packages/pip/_internal/utils/unpacking.py", line 252, in unpack_file
flatten=not filename.endswith('.whl')
File "/usr/lib/python2.7/site-packages/pip/_internal/utils/unpacking.py", line 112, in unzip_file
zipfp = open(filename, 'rb')
IOError: [Errno 2] No such file or directory: '/var/tmp/enum34-1.1.10-py2-none-any.whl'
然后我们尝试下载最新版本的 enum34*
pip download enum34*
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
ERROR: Invalid requirement: 'enum34*'
试试 pip download enum34
因为没有命名的包,如 enum34*
如下图所示。正确语法