尽管遵循所有说明
我遵循了所有指令概述在这里在安装过程中执行函数一个PIP包,但我仍然无法使用``pip install< my_package>''函数执行该功能。
我在 dist
文件夹中没有 .whl
文件。我的设置
文件具有与上述站点中提到的文件相同的格式,与以下内容:
import urllib.request
import requests
## made some deletions here for simplicity sake
from setuptools.command.develop import develop
from setuptools.command.install import install
this_directory = Path(__file__).parent
long_description = ( this_directory/ "README.md").read_text()
def temp():
print('running post installation')
s = 'https://storage.googleapis.com/download/storage/etc'
urllib.request.urlopen(s)
if not os.path.exists(fold):
os.mkdir(fold)
file = f'{fold}hey.txt' # this is got from elsewhere in the code
r = requests.get(s, stream=True, verify=False)
if r.status_code == 200:
r.raw.decode_content = 1
with open(file, 'wb') as f:
f.write(r.content)
else:
p('failed to download data files')
class PostDevelopCommand(develop):
"""Post-installation for development mode."""
def run(self):
temp()
develop.run(self)
class PostInstallCommand(install):
"""Post-installation for installation mode."""
def run(self):
temp()
install.run(self)
setup(
### simplified this a bit
install_requires=['Levenshtein',
'striprtf==0.0.12',
],
cmdclass={
'develop': PostDevelopCommand,
'install': PostInstallCommand,
},
classifiers=[
'Development Status :: 1 - Planning',
'Intended Audience :: Education',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Operating System :: MacOS',
'Programming Language :: Python :: 3.8',
],
)
下载包时,我什至没有读取: print('running post intert installation')导致相信函数
temp
未执行的代码>。我在做什么错?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法更改PIP日志
运行
pip install< my_package>
,您将仅看到pip
日志,并且在pip install
中无法更改它或调用某些功能。请想象,如果我们可以在pip安装
期间运行任何脚本,我们可以窃取任何不需要权限的信息。完成
设置的参数
函数setup.py
仅缺少设置
函数的一些参数。按照我的。另外,我不确定您正在正确运行构建,因此请使用答案中提供的构建命令。不要将下载包装与后安装式下载 Egg
它在
.egg
上打印在 python3设置。对我来说,这是愚蠢。You cannot change the pip logs
Running
pip install <my_package>
, you will see onlypip
logs, and you cannot change it or call some function duringpip install
. Just imagine, if we can run any script duringpip install
, we could steal any information that does not require permissions.Complete the arguments of the
setup
functionThe
setup.py
is only missing some arguments for thesetup
function. Follow the instructions of my answer. Also, I am not sure you're running the build properly, so please use the build command that has been provided in the answer.Do not confuse downloading the package with post-installing the egg
It is printed on post-installation of the
.egg
. So if you runpython3 setup.py sdist bdist_wheel
it will start to build the package and the text you print you will see in that logs. For me, it was the follofing.