python 如何在文件夹中组织其代码?

How python organized its code in the folder?

我是 python 的初学者,并且了解 python 如何组织其代码。

例如: https://github.com/HIPS/neural-fingerprint/blob/master/examples/regression.py

regession.py中,会导入neuralfingerprint目录。当我在 anaconda python 中 运行 regession.py 时,它说 neuralfingerprint 不存在。我需要再次复制 neuralfingerprint 以确保 neuralfingerprintregession.py 在同一个文件夹中。

有什么方便的方法吗?或者为什么作者将 regession.pyneuralfingerprint 放在不同的文件夹中?

谢谢。

那是因为你链接的是一个python库,需要安装后才能正常使用。从命令行,文件夹内的 运行 python setup.py,或仅在命令行上 运行 pip install git+https://github.com/HIPS/neural-fingerprint.git。这将安装库,python 将能够找到正确的文件。

但是,对于此库,还需要一些其他库,这些库不会自动安装。
安装 scipy:pip install scipyconda install scipy with anaconda
对于 RDKit:似乎你必须遵循 this