[英]pip package error after uploading to test.pypi.org
I have created a pip package as below 我创建了一个pip包,如下所示
my setup.py file 我的setup.py文件
import setuptools
with open('README.md') as f:
long_description = f.read()
setuptools.setup(
name="calculator_py",
version="0.0.1",
scripts=['scripts/calculate.py'],
author="xxxxxxx",
author_email="xxxx@gmail.com",
description="",
long_description=long_description,
long_description_content_type='text/markdown',
url="",
license='MIT',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
],
entry_points={
'console_scripts': [
'calculate=calculator.scripts.calculate:main',
],
}
)
I have uploaded this package to https://test.pypi.org 我已经将此包上传到https://test.pypi.org
after I have installed package using 在我安装软件包后
pip install -i https://test.pypi.org/simple/ calculator_py
I have checked package using 我已经检查过使用
pip list
when I try to import this package it gives me below error 当我尝试导入此程序包时,出现以下错误
ModuleNotFoundError: No module named 'calculator_py' ModuleNotFoundError:没有名为“ calculator_py”的模块
calculate.py file compute.py文件
class calculate:
def __init__(self):
pass
def add(self, arg1, arg2):
return arg1 + arg2
def sub(self, arg1, arg2):
return arg1 - arg2
def mul(self, arg1, arg2):
return arg1 * arg2
def div(self, arg1, arg2):
return arg1 / arg2
if __name__ == '__main__':
calculate()
how can I solve this issue? 我该如何解决这个问题?
You probably need a packages=['scripts']
inside your setuptools.setup
, eg. 您可能需要在
setuptools.setup
内部添加packages=['scripts']
,例如。
setuptools.setup(
...
packages=['scripts'],
...
)
Otherwise pip probably tries to guess it from name="calculator_py"
and you don't have a package named calculator_py
. 否则,pip可能会尝试从
name="calculator_py"
猜测出来,而您没有名为calculator_py
的软件包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.