简体   繁体   English

如何在Windows上pip install * .whl(使用通配符)

[英]How to pip install *.whl on Windows (using a wildcard)

For some reason, I cannot pip install %CD%\\*.whl as I will then get: 出于某种原因,我无法点击pip install %CD%\\*.whl因为我会得到:

Requirement 'C:\\Users\fredrik\\Downloads\\*.whl' looks like a filename, but the file does not exist
`*.whl is not a valid wheel filename.

On macOS (and I believe on Linux), I can do this without issues: 在macOS上(我相信Linux),我可以毫无问题地做到这一点:

pip install *.whl
Processing ./certifi-2017.11.5-py2.py3-none-any.whl
Processing ./chardet-3.0.4-py2.py3-none-any.whl
Processing ./idna-2.6-py2.py3-none-any.whl
Processing ./requests-2.18.4-py2.py3-none-any.whl
Processing ./urllib3-1.22-py2.py3-none-any.whl
...

  1. Why is there a difference in this behavior between the platforms? 为什么平台之间的这种行为存在差异?
  2. Is there a preferred way to make this ( pip install *.whl ) work on Windows? 是否有一种首选方法可以使这个( pip install *.whl )在Windows上运行?

If you know the package name eg foo You can use this: 如果您知道包名称,例如foo您可以使用:

python -m pip install --find-links=C:\Users\fredrik\Downloads foo

this will find any foo package eg foo-XYZ-cp37-cp37m-win_amd64.whl etc... 这将找到任何foo包,例如foo-XYZ-cp37-cp37m-win_amd64.whl等...

If you don't know the package name then you can try: 如果您不知道包名,那么您可以尝试:

FOR %%i in (C:\Users\fredrik\Downloads\*.whl) DO python -m pip install %i

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM