PIP安装“错误:包目录'X'不存在”
我正在尝试通过 PIP 安装 这个包,但是遇到了以下错误:
error: package directory 'RTbatch' does not exist
我觉得这很奇怪,因为 相关的 setup.py
文件里并没有提到任何 packages
变量,而只是提到了 py_modules
。
这是怎么回事呢?你能帮我一下吗?
以下是执行 pip install -e RTbatch
的完整输出:
Obtaining file:///home/chymera/RTbatch
Running setup.py (path:/home/chymera/RTbatch/setup.py) egg_info for package from file:///home/chymera/RTbatch
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'heywords'
warnings.warn(msg)
error: package directory 'RTbatch' does not exist
Complete output from command python setup.py egg_info:
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'heywords'
warnings.warn(msg)
running egg_info
creating RTbatch.egg-info
writing requirements to RTbatch.egg-info/requires.txt
writing RTbatch.egg-info/PKG-INFO
writing top-level names to RTbatch.egg-info/top_level.txt
writing dependency_links to RTbatch.egg-info/dependency_links.txt
writing manifest file 'RTbatch.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
error: package directory 'RTbatch' does not exist
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/chymera/RTbatch
Storing debug log for failure in /home/chymera/.pip/pip.log
4 个回答
0
看起来你在setup.py文件中把项目文件夹(RTbatch)当作一个包添加进去了。你需要确保setup.py里的包列表只包含Python包,也就是那些里面有init.py文件的文件夹。
希望这样能解决你的问题。
0
在我的情况下,我使用的是Windows系统,而当前的目录在不同的盘符上。直接用 python <完整路径,包括盘符>/setup.py install
这个命令会失败。我需要先切换到那个盘符和文件夹,然后再用 python setup.py
这个命令。
1
在我的情况下,问题出在我用来安装的文件夹坏了。安装没有完成。我先在我的笔记本电脑上下载了文件,然后把它移到服务器上,但那个文件夹是坏的。所以我又重新下载了一遍,结果一切都正常了。
8
py_modules
接受的是模块名称的列表,而不是文件。你调用的内容在寻找 RTBatch/py.py
和 RTBatch_cli/py.py
这两个文件。