我试图让我的代码可以从Github安装。在

在github中的一个文件夹中,我有一些具有相对导入的脚本。我试着运行脚本,但我遇到了错误。在

EDIT - If your script.py uses relative imports (and you don't want to change that), then there is no way to do it except getting that root path into the environment. You can do this in your script if you want, instead of setting it in the cmd shell or batch file. But it needs to get done somewhere. Here's how you can set the environment path in your script:

import sys
sys.path.append(r'..\..\path\to\my\package')
import package.other.anotherscript

所以现在我想知道我安装的Github的路径是什么,但是我似乎找不到它。它似乎安装正确,但就是不在那里。在

这是我的Github

这些是我的脚本,它们有相对的导入

这是我用来安装Github的。在

^{pr2}$

我试着用

print(sys.path)
os.listdir('lib')
os.listdir('lib/python3.6')
os.listdir('lib/python3.6/site-packages')

如果有其他信息可以让脚本和代码与相关导入一起在python包中工作,我们将不胜感激。在