[英]Install package using setup.py
I want to create and install my own packages, so I can import functionality.py into script.py into otehr functions in the program.我想创建和安装我自己的包,所以我可以将 functionality.py 导入 script.py 到程序中的其他函数中。 Following on from these instructions , I have:按照这些说明,我有:
/SRC
/package_one
__init__.py
script.py #Note: script.py imports from functionality.py
/package_two
__init__.py
functionality.py
setup.py
from package_two import functionality
functionality.execute()
def execute():
print ("Running functinality")
from setuptools import setup, find_packages
setup(name = 'pckage_two', packages = find_packages())
However, when i run:但是,当我运行时:
C:\Users\XXXX\XXXX\src> python setup.py install
from Terminal (in VS code with Anaconda) I get the following error:从终端(在带有 Anaconda 的 VS 代码中)我收到以下错误:
the process cannot access the file because it is being used by another process: 'c:\\users\\XXXX\\anaconda3\\lib\\site-packages\\pckage_two-0.0.0-py3.9.egg'
I am using Anaconda and VSCode, I have ran the python setup.py both from VScode terminal and Anaconda terminal我正在使用 Anaconda 和 VSCode,我已经从 VScode 终端和 Anaconda 终端运行了 python setup.py
The documentation on that site is rather out of date and you should not (unless you know exactly what you're doing) be creating a setup.py
at all, nor should you be running python setup.py install
which has legacy behavior that is no longer supported.该站点上的文档已经过时,您根本不应该(除非您确切地知道自己在做什么)创建setup.py
,也不应该运行具有遗留行为的python setup.py install
不再支持。
For more up-to-date information on modern Python packaging the best place to look, as of writing, is:有关现代 Python 打包的更多最新信息,在撰写本文时,最好的地方是:
https://packaging.python.org/en/latest/tutorials/packaging-projects/ https://packaging.python.org/en/latest/tutorials/packaging-projects/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.