distutils

Matplotlib in py2exe — ImportError: cannot import name dist (File “distutils\__init__.pyc”)

落爺英雄遲暮 提交于 2021-02-18 12:09:45
问题 Matplotlib working in this app perfectly.. but not working in build for some reason. Why? I'll gladly take any advice that can help me. .exe.log : Traceback (most recent call last): File "main.py", line 3, in <module> File "zipextimporter.pyc", line 82, in load_module File "matplotlib\__init__.pyc", line 103, in <module> File "zipextimporter.pyc", line 82, in load_module File "distutils\__init__.pyc", line 25, in <module> ImportError: cannot import name dist main.py is a script that I'm

Matplotlib in py2exe — ImportError: cannot import name dist (File “distutils\__init__.pyc”)

微笑、不失礼 提交于 2021-02-18 12:09:43
问题 Matplotlib working in this app perfectly.. but not working in build for some reason. Why? I'll gladly take any advice that can help me. .exe.log : Traceback (most recent call last): File "main.py", line 3, in <module> File "zipextimporter.pyc", line 82, in load_module File "matplotlib\__init__.pyc", line 103, in <module> File "zipextimporter.pyc", line 82, in load_module File "distutils\__init__.pyc", line 25, in <module> ImportError: cannot import name dist main.py is a script that I'm

Sort Versions in Python

隐身守侯 提交于 2021-02-16 04:22:40
问题 I'm trying to get it so that 1.7.0 comes after 1.7.0.rc0 but before 1.8.0, as it should if you were sorting versions. I thought the whole point of LooseVersion was that it handled the sorting and comparison of this kind of thing correctly. >>> from distutils.version import LooseVersion >>> versions = ["1.7.0", "1.7.0.rc0", "1.8.0"] >>> lv = [LooseVersion(v) for v in versions] >>> sorted(lv, reverse=True) [LooseVersion ('1.8.0'), LooseVersion ('1.7.0.rc0'), LooseVersion ('1.7.0')] 回答1: MAJOR

Error while trying to compile Python script to exe

笑着哭i 提交于 2021-02-11 12:47:23
问题 I'm trying to compile python script to exe. My script - hello.py : print("hello") My setup.py : from distutils.core import setup import py2exe, sys, os sys.argv.append('py2exe') setup( name = 'hello', description = 'hello script', version = '1.0', options = {'py2exe': {'bundle_files': 1, 'compressed': True,'dist_dir': ".",'dll_excludes':['w9xpopen.exe']}}, console = [{'script': r"hello.py"}], zipfile = None, ) I run: py -3 setup.py install The error: py -3 setup.py install running install

setup.py not installing swig extension module

半世苍凉 提交于 2021-02-09 09:31:57
问题 I'm struggling to figure out how to copy the wrapper generated by swig at the same level than the swig shared library. Consider this tree structure: │ .gitignore │ setup.py │ ├───hello ├───src │ hello.c │ hello.h │ hello.i │ └───test test_hello.py and this setup.py: import os import sys from setuptools import setup, find_packages, Extension from setuptools.command.build_py import build_py as _build_py class build_py(_build_py): def run(self): self.run_command("build_ext") return super().run()

“error: no commands supplied” when using distutils.core

天涯浪子 提交于 2021-02-05 11:34:10
问题 I am using Python 3 on CentOS 7. I am trying to build a C extension as described here. I have written a simple program, demo.c, which is in a directory in PYTHONPATH. demo.c has the following form. #include <stdio.h> #include <stdlib.h> int main() { printf("Hello from demo.c\n"); return 0; } This code runs without error. from distutils.core import setup, Extension module1 = Extension('demo', sources = ['demo.c']) However, the following code setup (name = 'PackageName', version = '1.0',

yaml file not getting copied when installing from setup.py

感情迁移 提交于 2021-01-29 09:30:11
问题 for my distutils package the yaml file along with python files is not getting copied setup.py from distutils.core import setup files = ["*.yaml", "package/*"] setup(name = "mypackage", version = "0.1", description = "description", author = "Ciasto", author_email = "me@email.com", packages = ['package'], package_data = {'package' : files }, scripts = ["scripts/runner"], ) this is the project directory structure: $ tree package/ |____ | |______init__.py | |____command.py | |____constants.py | |

Distutils ignores build/lib on Ubuntu

余生长醉 提交于 2021-01-28 13:41:55
问题 I have a setup.py script which builds files to be installed to the ./build/lib directory. The files are populated by the run() method of my custom distutils.command.build.build subclass: from distutils.command.build import build from distutils.core import setup class MyBuild(build): def run(self): # Populate files to ./build/lib setup( # ... cmdclass=dict(build=MyBuild) ) Now, according to this article the setup script should copy everything in the ./build/lib directory to the installation

pep 420 namespace_packages purpose in setup.py

╄→尐↘猪︶ㄣ 提交于 2021-01-28 05:57:24
问题 What is the purpose of the namespace_packages argument in setup.py when working with PEP420 namespace packages (the ones without __init__.py)? I played with it and saw no difference whether I declared the namespace packages or not. "setup.py install" and "pip install ." worked in any case. I am building an automatic setup.py code generator and would be happy not to handle this if this is not necessary. 回答1: As long as you: aim for Python 3.3 and newer or Python 2.7 with importlib2 dependency

How to install a dependency from a submodule in Python?

爱⌒轻易说出口 提交于 2021-01-26 23:14:59
问题 I have a Python project with the following structure (irrelevant source files omitted for simplicity): myproject/ mysubmodule/ setup.py setup.py The file myproject/setup.py uses distutils.core.setup to install the module myproject and the relevant sources. However, myproject requires mysubmodule to be installed (this is a git submodule). So what I am doing right now is: myproject/$ cd mysubmodule myproject/mysubmodule/$ python setup.py install myproject/mysubmodule/$ cd .. myproject/$ python