gpt4 book ai didi

Python setuptools install 没有安装包

转载 作者:行者123 更新时间:2023-11-28 18:07:17 25 4
gpt4 key购买 nike

我从这个 git 仓库创建了一个分支:https://github.com/QQuick/Opy

我在 opy 目录/包中添加了一个 __init__.py。当我运行 setup.py install 时,opy 包没有安装到我的 site-packages 目录中。为什么?

这是 setup.py 脚本:

import os
import sys

sys.path.append ('opy')
import opy

from setuptools import setup
import codecs

def read (*paths):
with codecs.open (os.path.join (*paths), 'r', encoding = 'utf-8') as aFile:
return aFile.read()

setup (
name = 'Opy',
version = opy.programVersion,
description = 'OPY - Obfuscator for Python, string obfuscation added, keyword added',
long_description = (
read ('README.rst') + '\n\n' +
read ('license_reference.txt')
),
keywords = ['opy', 'obfuscator', 'obfuscation', 'obfuscate', 'kivy', 'pyo', 'python'],
url = 'https://github.com/JdeH/Opy/',
license = 'Apache 2',
author = 'Jacques de Hooge',
author_email = 'jacques.de.hooge@qquick.org',
packages = ['opy'],
include_package_data = True,
install_requires = [],
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: Other/Proprietary License',
'Topic :: Software Development :: Libraries :: Python Modules',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
],
)

输出:

>python setup.py install
running install
running bdist_egg
running egg_info
creating Opy.egg-info
writing Opy.egg-info\PKG-INFO
writing top-level names to Opy.egg-info\top_level.txt
writing dependency_links to Opy.egg-info\dependency_links.txt
writing manifest file 'Opy.egg-info\SOURCES.txt'
reading manifest file 'Opy.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.des' found anywhere in distribution
writing manifest file 'Opy.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build
creating build\lib
creating build\lib\opy
copying opy\opy.py -> build\lib\opy
copying opy\opymaster.py -> build\lib\opy
copying opy\__init__.py -> build\lib\opy
creating build\bdist.win32
creating build\bdist.win32\egg
creating build\bdist.win32\egg\opy
copying build\lib\opy\opy.py -> build\bdist.win32\egg\opy
copying build\lib\opy\opymaster.py -> build\bdist.win32\egg\opy
copying build\lib\opy\__init__.py -> build\bdist.win32\egg\opy
byte-compiling build\bdist.win32\egg\opy\opy.py to opy.pyc
byte-compiling build\bdist.win32\egg\opy\opymaster.py to opymaster.pyc
byte-compiling build\bdist.win32\egg\opy\__init__.py to __init__.pyc
creating build\bdist.win32\egg\EGG-INFO
copying Opy.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
copying Opy.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
copying Opy.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO
copying Opy.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist\Opy-1.1.28.1-py2.7.egg' and adding 'build\bdist.win32\egg' to it
removing 'build\bdist.win32\egg' (and everything under it)
Processing Opy-1.1.28.1-py2.7.egg
Copying Opy-1.1.28.1-py2.7.egg to c:\python27\lib\site-packages
Adding Opy 1.1.28.1 to easy-install.pth file

Installed c:\python27\lib\site-packages\opy-1.1.28.1-py2.7.egg
Processing dependencies for Opy==1.1.28.1
Finished processing dependencies for Opy==1.1.28.1

最佳答案

总结评论中的陈述:

setuptools.setup 完成它的工作;然而,不是仅仅将模块复制到 site-packages(distutils 所做的),python setup.py install 将构建一个 egg 文件,它是然后只需将其复制到 site-packages 即可安装。这样,之后只需删除一个 egg 文件即可轻松卸载软件包。

如果您不喜欢将包安装在存档中,您可以:

  • 执行“旧的且难以管理的”安装:

    $ python setup.py install --old-and-unmanageable

    但请注意,这样做时您可能无法正确卸载软件包。仍然可以使用此命令,例如在您计划之后删除的虚拟环境中;

  • 使用 pip 因为它能够从源目录安装包:

    $ pip install dir/

    其中 dir 是包含 setup.py 脚本的目录。这是首选方式; pip 将首先构建一个 wheel 文件,然后安装它。模块将平装安装(作为文件写入磁盘),但 pip 还将在其他元数据中存储已安装文件的列表,因此所有文件都将在包卸载时正确删除。

关于Python setuptools install 没有安装包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52822899/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com