简体   繁体   中英

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 . I'm working in Python 3.5.1 on a Mac so I downloaded

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. When I try to run python3 setup.py install anyway I get the following error:

/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.

Not sure what's going on, I can't seem to find anyone else having this issue.

I've install python3 using homebrew.

The file you downloaded is a wheel file that should be installed using pip . The wheel file does not include the setup.py script which is required to build the package but is not used when installing wheels. First check you are using correct pip command (you need one for python 3.5), this is usually pip3.5 or pip3 command:

$ 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

$ pip3 install path/to/downloaded.whl

Or simply issue

$ pip3 install cython

as pip will download the latest package wheel for you. 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.

Note that, although suggested in the comments, it is not advised to install cython package via brew install :

$ 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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