Python Numpy 问题和 Python 版本问题
我想将 Numpy 与 Python 3.2 一起使用,但它不起作用;它说我需要3.1。除了使用 3.1 之外,有人知道如何解决这个问题吗?为了使其在 python 程序中工作,我必须导入什么?
我想用Python表示一个矩阵,并获得矩阵的范数。我该如何用 Numpy 来做这件事呢?是在 Numpy 还是 Python 中?矩阵乘法呢?而且,这个矩阵实际上是一个以 x 和 y 作为变量的向量。
最后一个问题。这里的一些成员认为使用 Python 3.2 并不是创建专业产品的最佳方式,尽管在 Python.org 上,他们特别指出使用 3.2 或 2.7 是当今最稳定的版本。我这里错了吗?如果是,我应该使用哪个版本的 Python?提前致谢。
另外,我没有足够的代表来发布三个单独的问题,所以如果您能回答一部分,我们将不胜感激。
I want to use Numpy with Python 3.2 and it won't work; it says I need 3.1. Does anyone know how to get around this issue, other than using 3.1? What do I have to import in order to make this work in a python program?
I want to represent a matrix in python, as well as get the norm of the matrix. How would I go about doing this with Numpy? Is that inside Numpy or Python? What about Matrix multiplication? Also, this matrix is actually a vector with x and y as its variables.
The final question. Some members on here feel that using Python 3.2 is not the best way to create a professional product, even though on Python.org, they specifically state that using 3.2 or 2.7 are the most stable versions available today. Am I wrong here? If I am, what version of Python should I use? Thanks in advance.
Also, I don't have enough rep to post three individual questions, so If you can answer a part, it would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
2011 年 5 月 14 日发布的 NumPy 1.6.0 支持 Python 3.2.之前的版本 (1.5.1) 是在 Python 3.2 之前发布的。那么您使用的 NumPy 版本是什么?如果它是 1.6.0 并且在 3.2 上不起作用,则可能是 NumPy 的错误,您应该将其报告给 NumPy。
关于 numpy 的基本使用,请使用本教程。我可以看到它很早就涵盖了数组创建和乘法。有关规范,请参阅此参考页面。
关于是否使用 Python 2.7 还是 3.2,python.org 上的一个页面对此进行了讨论细节。
NumPy 1.6.0 released on 5/14/2011 supports Python 3.2. The prior version (1.5.1) was released prior to Python 3.2. So what version of NumPy are you using? If it's 1.6.0 and it's not working on 3.2 it might be a bug with NumPy and you should report it to NumPy.
Regarding basic use of
numpy
, use this tutorial. I can see that it covers array creation and multiplication fairly early on. Regarding norms, see this reference page.Regarding whether to use Python 2.7 or 3.2, there's a page at python.org that discusses this in detail.
您应该考虑查看 numpy 文档和教程来熟悉它的工作原理:
http://docs。 scipy.org/doc/
链接
该文档包含很多示例基于每个函数,例如,如果您想了解如何采用规范,请查看
http://docs.scipy.org/doc/numpy/reference/ generated/numpy.linalg.norm.html
You should consider looking at the numpy documentation and the tutorials to familiarize yourself with how it works:
http://docs.scipy.org/doc/
Link
The documentation includes a lot of examples on a per function basis, so for example if you wanted to find how to take the norm, take a look at
http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.norm.html