Too*_*one 9 python windows pypy numpy
我刚刚在Windows上安装了PyPy,并且在我运行的一些模拟代码中看到了大约10倍的速度提升.我也希望看到使用numpy的代码类似.我不是一个经验丰富的Python程序员,但我发现很难遵循这些说明.有没有人知道如果在Windows上为PyPy安装numpy是可能的,如果是这样,最简单的方法是什么?
说明提供了两个选项.
选项1
如果你有pip(命令行假定它找到属于PyPy的pip,而不是CPython中的pip):
pip install git+https://bitbucket.org/pypy/numpy.git
Run Code Online (Sandbox Code Playgroud)
这似乎是一个很好的选择,但我pip在目录结构中找不到我解压缩.
选项2
或者,直接的方式:
git clone https://bitbucket.org/pypy/numpy.git
cd numpy
pypy setup.py install
Run Code Online (Sandbox Code Playgroud)
我没有登录gitWindows,但我也怀疑这个选项可能涉及从Windows编译源代码https://bitbucket.org/pypy/numpy.git,甚至可能无法(或需要大量黑客攻击).
编辑
通过安装PIP https://sites.google.com/site/pydatalog/python/pip-for-windows按照下面的答案,或在说明这个答案的问题,我如何在Windows上安装PIP?,失败了ConnectionError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /packages/py2.py3/p/pip/pip-1.5.4-py2.py3-none-any.whl (Caused by <class 'httplib.BadStatusLine'>: '').例如,参见此错误报告.不过,我是能够通过微软的Visual Studio安装PIP PTVS通过右键单击在Solution Explorer中的Python环境PyPy 2.7,选择安装Python包.这无法安装numpy(另一个连接错误),但确实安装了pip.
现在我有了pip,我尝试使用命令行安装numpy pip install git+https://bitbucket.org/pypy/numpy.git.首先我需要安装git才能做到这一点......没问题.但随后它失败了以下
building library "npymath" sources
No module named numpy.distutils.msvccompiler in numpy.distutils; trying from distutils
error: Unable to find vcvarsall.bat
Run Code Online (Sandbox Code Playgroud)
我不熟悉Python软件包的安装,我不确定这意味着什么.我安装了C++编译器的Visual Studio 2012,但另一方面,Python 3.3的这个线程(我现在使用2.7)似乎暗示不应该需要C++编译器.
编辑
这似乎与pip安装无关.选项2
git clone https://bitbucket.org/pypy/numpy.git
cd numpy
pypy setup.py install
Run Code Online (Sandbox Code Playgroud)
我还是得到的Unable to find vcvarsall.bat.但是,如果将环境变量设置为适当的目录,则可以找到此答案的提示.在我的情况下,我有VS2012,所以适当的行是vcvarsall.batVS90COMNTOOLS
set VS90COMNTOOLS=%VS110COMNTOOLS%
Run Code Online (Sandbox Code Playgroud)
现在可以找到编译器,但是存在编译错误
_configtest.c
_configtest.c(4) : error C2061: syntax error : identifier 'npy_check_sizeof_type'
_configtest.c(4) : error C2059: syntax error : ';'
_configtest.c(7) : error C2065: 'npy_check_sizeof_type' : undeclared identifier error:
Run Code Online (Sandbox Code Playgroud)
看起来这是在编译过程中生成的文件,甚至可能根本不需要构建.不过我觉得我现在可能真的被卡住了......
对于第一个选项,您应该从下载 pip
https://sites.google.com/site/pydatalog/python/pip-for-windows
之后,您应该在环境变量 PATH 中添加 pip 的路径。
最后,您应该使用命令提示符并使用
pip 安装 git+ https://bitbucket.org/pypy/numpy.git