Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 与安装相比,生成的车轮不一致_Python_Python 3.x_Pip_Setuptools - Fatal编程技术网

Python 与安装相比,生成的车轮不一致

Python 与安装相比,生成的车轮不一致,python,python-3.x,pip,setuptools,Python,Python 3.x,Pip,Setuptools,我有以下文件: setup.py problems/ __init__.py sometimes_included/ file.txt \uuuu init\uuuu.py仅包含: import os with open(os.path.join(os.path.join(os.path.dirname(__file__), "sometimes_included"), "file.txt")) as f: print(f.read()) 而file.

我有以下文件:

setup.py
problems/
    __init__.py
    sometimes_included/
        file.txt
\uuuu init\uuuu.py
仅包含:

import os
with open(os.path.join(os.path.join(os.path.dirname(__file__), "sometimes_included"), "file.txt")) as f:
    print(f.read())
file.txt
只是一些虚拟文本

该文件在

当我
pip3安装时https://github.com/ysangkok/packaging-problems/archive/master.zip

然后
python3-c“导入问题”
它不工作(txt文件未安装)

但是如果我克隆git repo和
python3 setup.py安装--user
,它就可以工作了


如何在不将
问题/有时作为一个包包含在
setup.py
中的情况下实现一致的行为。此目录不是一个包,它不需要
\uuuu init\uuuuu.py
。考虑到它在不使用控制盘时有效,我想知道是否有办法。

创建一个文件
清单。在
中使用
包含问题/有时包含/file.txt

确保文件包含在sdist中,但不包含在控制盘中,并且控制盘是pip使用的。这似乎是不必要的。如果我将
package\u data
更改为reference
有时包含/file.txt
而不是
problems/有时包含/file.txt
,我可以使用wheels或旧方法安装。我在他的存储库中测试了它,并将文件包含在wheel中。