简体   繁体   English

尝试安装Cython:在下载的Cython目录中没有setup.py

[英]Trying to install Cython: no setup.py in downloaded Cython directory

I downloaded the newest Cython release from https://pypi.python.org/pypi/Cython/#downloads . 我从https://pypi.python.org/pypi/Cython/#downloads下载了最新的Cython版本。 I'm working in Python 3.5.1 on a Mac so I downloaded 我在Mac上使用Python 3.5.1,所以我下载了

Cython-0.26.1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

I unzipped it and entered the /Cython directory, but there is no setup.py in the directory. 我解压缩并进入/ Cython目录,但目录中没有setup.py。 When I try to run python3 setup.py install anyway I get the following error: 当我尝试运行python3 setup.py install ,我收到以下错误:

/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory

It doesn't seem to be looking in the /Cython directory I am in, but there is also no setup.py in that directory. 它似乎没有在我所在的/ Cython目录中查找,但该目录中也没有setup.py。

Not sure what's going on, I can't seem to find anyone else having this issue. 不知道发生了什么,我似乎找不到其他人有这个问题。

I've install python3 using homebrew. 我用自制软件安装了python3。

The file you downloaded is a wheel file that should be installed using pip . 您下载的文件是应使用pip安装的wheel文件。 The wheel file does not include the setup.py script which is required to build the package but is not used when installing wheels. wheel文件不包含构建软件包所需的setup.py脚本,但在安装wheel时不使用。 First check you are using correct pip command (you need one for python 3.5), this is usually pip3.5 or pip3 command: 首先检查你是否正在使用正确的pip命令(你需要一个用于python 3.5),这通常是pip3.5pip3命令:

$ pip3 -V
pip 9.0.1 from /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (python 3.5)

To install cython from the downloaded wheel, issue 要从下载的滚轮安装cython ,请发出

$ pip3 install path/to/downloaded.whl

Or simply issue 或者只是发布

$ pip3 install cython

as pip will download the latest package wheel for you. 正如pip将为您下载最新的包轮。 Since you installed python 3.5 via Homebrew, you probably have to switch to the user you use to install packages with Homebrew or the installation with pip will fail. 由于您通过Homebrew安装了python 3.5,因此您可能必须切换到用于使用Homebrew安装软件包的用户,否则使用pip安装将失败。

Note that, although suggested in the comments, it is not advised to install cython package via brew install : 请注意,虽然在评论中建议,但不建议通过brew install安装cython包:

$ brew info cython
...
==> Caveats
This formula is keg-only, which means it was not symlinked into 
/usr/local,
because this formula is mainly used internally by other formulae.
Users are advised to use `pip` to install cython.

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

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