安装python软件包时setuptools的问题

时间:2020-10-21 13:18:54

标签: python pip package

我已经使用以下setup.py文件设置了可安装的python包:

'''pytemstore setup script'''
import os
import re
from setuptools import setup, find_packages


def read(relpath: str) -> bytes:
    '''
    Returns contents of a file at a path relative to this scripts location
    '''
    root_path = os.path.dirname(__file__)
    canonical_path = os.path.join(root_path, relpath)
    with open(canonical_path, 'rt') as file:
        return file.read()

VERSION_RE = r'^\s*__version__\s*=\s*(\"|\')(?P<version>.*)\1'
def get_version() -> str:
    '''Get __version__ variable's name from root __init__'''
    match = re.search(VERSION_RE, read('./pytemstore/__init__.py'), re.M)
    if not match:
        raise ValueError("Failed to find package version!")
    return match['version']

setup(
    name='pytemstore',
    author='Maximus Wasylow',
    author_email='bamwasylow@gmail.com',
    version=get_version(),
    description='Deconstruct item-store python client-side library',
    long_description=read('README.md'),
    url='https://bitbucket.org/tm-ep/pytemstore.git',
    python_requires='>=3.6',
    install_requires=[
        'requests'
    ],
    packages=find_packages(),
    dependency_links=[
        'https://github.com/bamaxw/ion/archive/master.zip'
    ]
)

但是当我尝试以可编辑模式(pipenv install -e .)安装软件包时 我收到此错误

    Complete output from command /Users/robinnicole/.pyenv/versions/3.7.4/bin/python3.7 -c "import setuptools, tokenize;__file__='/Users/robinnicole/CodeCommit/pytemstore/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'setuptools'

    ----------------------------------------
  Rolling back uninstall of pytemstore
  Moving to /Users/robinnicole/.pyenv/versions/3.7.4/lib/python3.7/site-packages/pytemstore.egg-link
   from /private/var/folders/rl/2j4yk1bd1k5csl3d6ztt02nj2c_4lt/T/pip-uninstall-xbqln5ib/pytemstore.egg-link
Command "/Users/robinnicole/.pyenv/versions/3.7.4/bin/python3.7 -c "import setuptools, tokenize;__file__='/Users/robinnicole/CodeCommit/pytemstore/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps" failed with error code 1 in /Users/robinnicole/CodeCommit/pytemstore/

奇怪的是,setuptools已安装在我的python软件包中,并且手动运行/Users/robinnicole/.pyenv/versions/3.7.4/bin/python3.7 -c "import setuptools不会返回任何错误

您遇到过这样的错误吗?

0 个答案:

没有答案