我正在尝试从.whl文件安装Python包numpy。这个answer提供了使用pip / wheel安装包的语法:
pip install --use-wheel --no-index --find-links=/where/its/downloaded package_name
因此在downloading .whl文件之后重命名numpy.whl
我会相应地遵循以下语法:
cd C:\Python27\Scripts
pip install --use-wheel --no-index --find-links=C:\Users\User Name\Downloads numpy
当我这样做时,我得到了
Ignoring indexes: https://pypi.python.org/simple
Exception:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\basecommand.py", line 232, in main
status = self.run(options, args)
File "C:\Python27\lib\site-packages\pip\commands\install.py", line 305, in run
name, None, isolated=options.isolated_mode,
File "C:\Python27\lib\site-packages\pip\req\req_install.py", line 181, in from
_line
isolated=isolated)
File "C:\Python27\lib\site-packages\pip\req\req_install.py", line 54, in __ini
t__
req = pkg_resources.Requirement.parse(req)
File "C:\Python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", li
ne 2873, in parse
reqs = list(parse_requirements(s))
File "C:\Python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", li
ne 2820, in parse_requirements
"version spec")
File "C:\Python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", li
ne 2785, in scan_list
raise ValueError(msg, line, "at", line[p:])
ValueError: ('Expected version spec in', 'Name\\Downloads', 'at', '\\Downloads
')
我下载了numpy‑1.9.2+mkl‑cp27‑none‑win_amd64.whl
文件并在64位架构上运行Python 2.7,所以我不认为我下载的版本是问题所在。我能想到的另一个问题是原始答案中的语法是linux编写的,我找不到处理Windows目录的示例。另一个问题可能是我的User Name
是两个单词,其中有一个空格,Wheel没有设置处理。我尝试在空间前添加/
,以防出现问题,但没有骰子。如何使用.whl文件在Windows上安装Python包?