Я следую примеру setuptools из документации по щелчку python здесь с использованием виртуального окружения python3.7.1 conda и продолжаю получать ошибку:
ModuleNotFoundError: No module named 'yourpackage.scripts'
Я, должно быть, упускаю что-то очевидное здесь, но не уверен, что это такое.
yourpackage/
├── __init__.py
├── main.py
├── scripts
│ ├── __init__.py
│ └── yourscript.py
├── setup.py
└── utils.py
#scripts/yourscript.py
import click
@click.command()
def cli():
"""Example script."""
click.echo('Hello World!')
# setup.py
from setuptools import setup, find_packages
setup(
name='yourpackage',
version='0.1',
packages=find_packages(),
include_package_data=True,
install_requires=[
'Click',
],
entry_points='''
[console_scripts]
yourscript=yourpackage.scripts.yourscript:cli
''',
)
$ pip install -e .
Looking in indexes: https://InternalArtifactoryUrl
Obtaining file:///private/tmp/yourpackage
Requirement already satisfied: Click in /Users/myusername/miniconda3/envs/test_20190220/lib/python3.7/site-packages (from yourpackage==0.1) (7.0)
Installing collected packages: yourpackage
Found existing installation: yourpackage 0.1
Uninstalling yourpackage-0.1:
Successfully uninstalled yourpackage-0.1
Running setup.py develop for yourpackage
Successfully installed yourpackage
$ which yourscript
/Users/myusername/miniconda3/envs/test_20190220/bin/yourscript
$ yourscript
Traceback (most recent call last):
File "/Users/myusername/miniconda3/envs/test_20190220/bin/yourscript", line 11, in <module>
load_entry_point('yourpackage', 'console_scripts', 'yourscript')()
File "/Users/myusername/miniconda3/envs/test_20190220/lib/python3.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Users/myusername/miniconda3/envs/test_20190220/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
return ep.load()
File "/Users/myusername/miniconda3/envs/test_20190220/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2411, in load
return self.resolve()
File "/Users/myusername/miniconda3/envs/test_20190220/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2417, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'yourpackage.scripts'
Я также попробовал следующее в моей директории пакета: export PYTHONPATH=/tmp/yourpackage/
и продолжаю получатьошибка при запуске yourscript