distutils

Using Cython To Link Python To A Shared Library

不想你离开。 提交于 2019-11-26 15:10:04
问题 I am trying to integrate a third party library written in C with my python application using Cython . I have all of the python code written for a test. I am having trouble finding an example for setting this up. I have a pyd/pyx file I created manually. The third party has given me a header file (*.h) and a shared library (*.so) . As far as I can tell, there are no other dependencies. Can someone provide an example of how to set this up using Cython and disutils ? Thanks 回答1: Sure ! (In the

MANIFEST.in ignored on “python setup.py install” - no data files installed?

醉酒当歌 提交于 2019-11-26 12:08:00
问题 Here\'s my stripped-down setup.py script with non-code stuff removed: #!/usr/bin/env python from distutils.core import setup from whyteboard.misc import meta setup( name = \'Whyteboard\', version = meta.version, packages = [\'whyteboard\', \'whyteboard.gui\', \'whyteboard.lib\', \'whyteboard.lib.pubsub\', \'whyteboard.lib.pubsub.core\', \'whyteboard.lib.pubsub.utils\', \'whyteboard.misc\'], py_modules = [\'whyteboard\'], scripts = [\'whyteboard.py\'], ) MANIFEST.in: include *.txt include

How to use MinGW's gcc compiler when installing Python package using Pip?

核能气质少年 提交于 2019-11-26 12:05:00
I configured MinGW and distutils so now I can compile extensions using this command: setup.py install MinGW's gcc compiler will be used and package will be installed. For that I installed MinGW and created distutils.cfg file with following content: [build] compiler = mingw32 It's cool but now I'd like to use all pip benefits. Is there a way to use the same MinGW's gcc compiler in pip? So that when I run this: pip install <package name> pip will use MinGW's gcc compiler and compile C code if needed? Currently I get this error: Unable to find vcvarsall.bat . Seems pip doesn't know that I have

Compiling with cython and mingw produces gcc: error: unrecognized command line option &#39;-mno-cygwin&#39;

陌路散爱 提交于 2019-11-26 12:04:38
I'm trying to compile a python extension with cython in win 7 64-bit using mingw (64-bit). I'm working with Python 2.6 (Active Python 2.6.6) and with the adequate distutils.cfg file (setting mingw as the compiler) When executing > C:\Python26\programas\Cython>python setup.py build_ext --inplace I get an error saying that gcc has not an -mno-cygwin option: > C:\Python26\programas\Cython>python setup.py build_ext --inplace running build_ext skipping 'hello2.c' Cython extension (up-to-date) building 'hello2' extension C:\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python26\include -IC:

Including non-Python files with setup.py

China☆狼群 提交于 2019-11-26 11:39:06
How do I make setup.py include a file that isn't part of the code? (Specifically, it's a license file, but it could be any other thing.) I want to be able to control the location of the file. In the original source folder, the file is in the root of the package. (i.e. on the same level as the topmost __init__.py .) I want it to stay exactly there when the package is installed, regardless of operating system. How do I do that? Hans L Probably the best way to do this is to use the setuptools package_data directive. This does mean using setuptools (or distribute ) instead of distutils , but this

Run custom task when call `pip install`

两盒软妹~` 提交于 2019-11-26 11:27:05
问题 I want to make my python package \"pip installable\". The problem is that the package has shell script that must be sourced in the user\'s init shell script (e.g. .bashrc ). But after the installation, the user don\'t exactly know where the script went (presumably /usr/bin , but we can\'t garantee). Of course the user can runs which myscript.sh and manually edits his init script. But I want to automate this step. I can create a new distutils command, but pip install doesn\'t call it. And I

How can I install Python modules programmatically / through a Python script?

二次信任 提交于 2019-11-26 11:17:13
问题 Can I download and install Python modules from PyPi strictly inside a script, without using a shell at all ? I use a non-standard Python environment, Autodesk Maya\'s Python interpreter. This does not come with \"easy_install,\" and there is no \"shell,\" only a python script interpreter invoked by the main Maya executable. Copying and pasting ez_setup.py\'s contents into the script editor window and running it correctly installs an easy_install somewhere into Maya\'s directory, but the

How can I make setuptools install a package that&#39;s not on PyPI?

杀马特。学长 韩版系。学妹 提交于 2019-11-26 11:03:33
I've just started working with setuptools and virtualenv. My package requires the latest python-gearman that is only available from GitHub. The python-gearman version that's on PyPI is an old one. The Github source is setuptools-compatible, i.e. has setup.py, etc. Is there a way to make setuptools download and install the new version instead of looking for it on PyPI and installing the old one? FYI, the new python-gearman is http://github.com/mtai/python-gearman PJ Eby The key is to tell easy_install where the package can be downloaded. In this particular case, it can be found at the url http:

How can I add post-install scripts to easy_install / setuptools / distutils?

☆樱花仙子☆ 提交于 2019-11-26 09:36:57
问题 I would like to be able to add a hook to my setup.py that will be run post-install (either when easy_install\'ing or when doing python setup.py install). In my project, PySmell, I have some support files for Vim and Emacs. When a user installs PySmell the usual way, these files get copied in the actual egg, and the user has to fish them out and place them in his .vim or .emacs directories. What I want is either asking the user, post-installation, where would he like these files copied, or

ValueError: Unknown MS Compiler version 1900

感情迁移 提交于 2019-11-26 08:09:45
问题 I am trying to run some code with Python 3.5 on Windows 10 with the use of cygwin (mingw). To be precise I am using the PyDSTool module, where I call the dopri integrator. The problem is, I am having trouble with distutils not recognizing Microsoft Visual Studio 2015. Is there a way to avoid this (without going back to older versions of Python, Windows, Visual Studio). The full Error can be seen bellow. ValueError Traceback (most recent call last) <ipython-input-16-bfeb915bfd7b> in <module>()