版本名称“cp27”或“cp35”在 Python 中是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37023557/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does version name 'cp27' or 'cp35' mean in Python?
提问by Tom
What does version name 'cp27' or 'cp35' mean in Python?
版本名称“cp27”或“cp35”在 Python 中是什么意思?
Like the files in https://pypi.python.org/pypi/gensim#downloads
像https://pypi.python.org/pypi/gensim#downloads 中的文件
I am using Python 2.7 on a 64-bit Window 7 PC, and don't know which version of python package I should install.
我在 64 位 Window 7 PC 上使用 Python 2.7,但不知道我应该安装哪个版本的 Python 包。
There are three questions:
共有三个问题:
Which of "gensim-0.12.4-cp27-none-win_amd64.whl" or "gensim-0.12.4.win-amd64-py2.7.exe" should I install? I have installed 'WinPython-64bit-2.7.10.3' on 64-bit Window 7 PC which I am using.
What does 'cp27' mean in Python or Python version name? I searched online with keywords 'Python cp27' but failed to find any answers.
Are there differences between these two versions of python packages? ('0.12.4-cp27-none-win_amd64' and 'win-amd64-py2.7') If there are, what are the differences?
我应该安装“ gensim-0.12.4-cp27-none-win_amd64.whl”或“ gensim-0.12.4.win-amd64-py2.7.exe”中的哪一个?我已经在我正在使用的 64 位 Window 7 PC 上安装了“WinPython-64bit-2.7.10.3”。
' cp27' 在 Python 或 Python 版本名称中是什么意思?我用关键字“Python cp27”在线搜索,但没有找到任何答案。
这两个版本的python包有区别吗?(' 0.12.4-cp27-none-win_amd64'和' win-amd64-py2.7')如果有,有什么区别?
回答by Wayne Werner
If you check out the Python Enhancement Proposal(more commonly known as a PEP), you'll see that the cpN
refers to the particular version of Python
如果您查看Python Enhancement Proposal(通常称为 PEP),您会看到cpN
指的是特定版本的 Python
in gensim-0.12.4-cp27-none-win_amd64.whl
you can break it apart:
在gensim-0.12.4-cp27-none-win_amd64.whl
你可以打破它拆开:
- 0.12.4- package version, they maybe using semantic versioning
- cp27- this package is for CPython. IronPython, Jython, or PyPy will probably be unhappy.
- none- no feature of this package depends on the python Application Binary Interface, or ABI
- win_amd64- this has been compiled for 64-bit Windows. That means that it probably has some code written in C/C++
- .whl- that means this is a wheel distribution. Which is handy, because it means if you're running CPython 2.7 64-bit on Windows, and assuming you have pip installed, all you have to do to get this package is run:
py -2.7 -m pip install --use-wheel gensim
(assuming that it's available on pypi, of course). You mayneed topy -2.7 -m pip install wheel
first. But other than that, that should be all it takes.
- 0.12.4- 包版本,他们可能使用语义版本控制
- cp27- 这个包是用于 CPython 的。IronPython、Jython 或 PyPy 可能会不高兴。
- none- 此包的任何功能都不依赖于 python应用程序二进制接口或 ABI
- win_amd64- 这是为 64 位 Windows 编译的。这意味着它可能有一些用 C/C++ 编写的代码
- .whl- 这意味着这是一个轮子分布。这很方便,因为这意味着如果您在 Windows 上运行 CPython 2.7 64 位,并且假设您安装了 pip,那么您需要做的就是运行这个包:(
py -2.7 -m pip install --use-wheel gensim
当然,假设它在 pypi 上可用) . 你可能需要py -2.7 -m pip install wheel
先。但除此之外,仅此而已。
回答by Didier Trosset
These stand for the version of CPython (i.e. the Python official distribution you get from python.org) which the wheel files are built for.
这些代表了构建轮文件的 CPython 版本(即您从 python.org 获得的 Python 官方发行版)。
For example cp27
is meant to be used on a CPython version 2.7.
例如cp27
,旨在用于 CPython 2.7 版。
Warning: cp32
is meant to be used in a CPython version 3.2. The difference between the 32 bits version and the 64 bits version is stated in another suffix, e.g. win32
or amd64
in the filename.
警告:cp32
旨在用于 CPython 3.2 版。32 位版本和 64 位版本之间的区别在另一个后缀中说明,例如win32
或amd64
在文件名中。