setuptools

Package only binary compiled .so files of a python library compiled with Cython

 ̄綄美尐妖づ 提交于 2019-12-17 22:52:26
问题 I have a package named mypack which inside has a module mymod.py , and the __init__.py . For some reason that is not in debate, I need to package this module compiled (nor .py or .pyc files are allowed). That is, the __init__.py is the only source file allowed in the distributed compressed file. The folder structure is: . │ ├── mypack │ ├── __init__.py │ └── mymod.py ├── setup.py I find that Cython is able to do this, by converting each .py file in a .so library that can be directly imported

Can a Python package depend on a specific version control revision of another Python package?

空扰寡人 提交于 2019-12-17 22:37:04
问题 Some useful Python packages are broken on pypi, and the only acceptable version is a particular revision in a revision control system. Can that be expressed in setup.py e.g requires = 'svn://example.org/useful.package/trunk@1234' ? 回答1: You need to do two things. First, require the exact version you want, e.g.: install_requires = "useful.package==1.9dev-r1234" and then include a dependency_links setting specifying where to find it: dependency_links = ["svn://example.org/useful.package/trunk

Upgrading setuptools on OSX El Capitan

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 22:29:10
问题 I'm trying to upgrade setuptools. Well actually I'm trying to upgrade ansible but it's trying to upgrade setuptools and failing. Trying to do it myself also fails. Even trying to uninstall it fails $ sudo -H pip install --upgrade setuptools Collecting setuptools Using cached setuptools-18.4-py2.py3-none-any.whl Installing collected packages: setuptools Found existing installation: setuptools 1.1.6 Uninstalling setuptools-1.1.6: Exception: Traceback (most recent call last): File "/Library

How to install setuptools?

折月煮酒 提交于 2019-12-17 19:04:25
问题 I'm trying to install setuptools. When I run "sh setuptools-0.6c9-py2.4.egg" I get the following message: Permission denied: '/usr/lib/python2.4/site-packages/test-easy-install-26338.write-test' It is expectable, since I do not have root permissions on the system. Some how I came to the idea of creating a "Virtual" Python. I download "virtual-python.py" and run it using the site-wide Python. It creates "lib", "bin" and "include" sub-directories in my home-directory. In the end of the output

What is the correct way to share package version with setup.py and the package?

空扰寡人 提交于 2019-12-17 17:24:23
问题 With distutils , setuptools , etc. a package version is specified in setup.py : # file: setup.py ... setup( name='foobar', version='1.0.0', # other attributes ) I would like to be able to access the same version number from within the package: >>> import foobar >>> foobar.__version__ '1.0.0' I could add __version__ = '1.0.0' to my package's __init__.py, but I would also like to include additional imports in my package to create a simplified interface to the package: # file: __init__.py from

Python第三方库安装及常见问题

孤街醉人 提交于 2019-12-17 16:33:06
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 源码安装 Python第三方库几乎都可以在github或者 pypi上找到源码。源码包格式大概有zip 、 tar.zip、 tar.bz2。解压这些包,进入解压好的文件夹,通常会有一个setup.py的文件。打开命令行,进入该文件夹。运行以下命令,就能把这个第三库安装到系统里: python setup.py install 或者借助pip,则不需要解压: pip install package.zip 包管理器安装 现在很多编程语言,都带有包管理器,例如 Ruby 的 gem,nodejs的npm。 在Python中,安装第三方模块,是通过setuptools这个工具完成的。Python有两个封装了setuptools的包管理工具:easy_install和pip。目前官方推荐使用pip。 用easy_install和pip来安装第三方库很方便 它们的原理其实就是从Python的官方源pypi.python.org/pypi 下载到本地,然后解包安装。 基本操作命令如下: # 安装package pip install packagename # 卸载package pip uninstall packagename # 查看所安装的package pip list # 将项目依赖的库重定向输出到文件

Latest 'pip' fails with “requires setuptools >= 0.8 for dist-info”

徘徊边缘 提交于 2019-12-17 10:13:06
问题 Using the recent (1.5) version of pip , I get an error when attempting to update several packages. For example, sudo pip install -U pytz results in failure with: Wheel installs require setuptools >= 0.8 for dist-info support. pip's wheel support requires setuptools >= 0.8 for dist-info support. I don't understand this message (I have setuptools 2.1) or what to do about it. Exception information from the log for this error: Exception information: Traceback (most recent call last): File "

How to force a python wheel to be platform specific when building it?

穿精又带淫゛_ 提交于 2019-12-17 09:46:15
问题 I am working on a python2 package in which the setup.py contains some custom install commands. These commands actually build some Rust code and output some .dylib files that are moved into the python package. An important point is that the Rust code is outside the python package. setuptools is supposed to detect automatically if the python package is pure python or platform specific (if it contains some C extensions for instance). In my case, when I run python setup.py bdist_wheel , the

Execute a Python script post install using distutils / setuptools

╄→尐↘猪︶ㄣ 提交于 2019-12-17 05:54:49
问题 I'm trying to add a post-install task to Python distutils as described in How to extend distutils with a simple post install script?. The task is supposed to execute a Python script in the installed lib directory . This script generates additional Python modules the installed package requires. My first attempt is as follows: from distutils.core import setup from distutils.command.install import install class post_install(install): def run(self): install.run(self) from subprocess import call

Execute a Python script post install using distutils / setuptools

戏子无情 提交于 2019-12-17 05:54:18
问题 I'm trying to add a post-install task to Python distutils as described in How to extend distutils with a simple post install script?. The task is supposed to execute a Python script in the installed lib directory . This script generates additional Python modules the installed package requires. My first attempt is as follows: from distutils.core import setup from distutils.command.install import install class post_install(install): def run(self): install.run(self) from subprocess import call