可能是在某个地方被问到并得到了答案,但我搜索了很多,但没有找到哪里。抱歉重复。
我有一个项目(https://github.com/PyFPGA/openflow)这取决于pyyaml:
setup(
...,
install_requires=['pyyaml']
)
与pip3 install -e .
一起安装时,不会安装pyyaml。可通过以下方式进行验证:
$ virtualenv venv1 --python=python3
$ venv1/bin/python3 -m pip install -e .
Obtaining file:///home/ram/repos_ram/PyFPGA/openflow
ERROR: Command errored out with exit status 1:
command: /home/ram/repos_ram/PyFPGA/openflow/venv1/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/ram/repos_ram/PyFPGA/openflow/setup.py'"'"'; __file__='"'"'/home/ram/repos_ram/PyFPGA/openflow/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-bzc9au74
cwd: /home/ram/repos_ram/PyFPGA/openflow/
Complete output (9 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/ram/repos_ram/PyFPGA/openflow/setup.py", line 3, in <module>
import openflow
File "/home/ram/repos_ram/PyFPGA/openflow/openflow/__init__.py", line 6, in <module>
from openflow.configure import ConfigureTools
File "/home/ram/repos_ram/PyFPGA/openflow/openflow/configure.py", line 25, in <module>
from yaml import safe_load, dump
ImportError: No module named 'yaml'
----------------------------------------
WARNING: Discarding file:///home/ram/repos_ram/PyFPGA/openflow. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ram@ram-notebook2:~/repos_ram/PyFPGA/openflow$
ram@ram-notebook2:~/repos_ram/PyFPGA/openflow$
ram@ram-notebook2:~/repos_ram/PyFPGA/openflow$ venv1/bin/python3 -m pip install -e .
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Obtaining file:///home/ram/repos_ram/PyFPGA/openflow
ERROR: Command errored out with exit status 1:
command: /home/ram/repos_ram/PyFPGA/openflow/venv1/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/ram/repos_ram/PyFPGA/openflow/setup.py'"'"'; __file__='"'"'/home/ram/repos_ram/PyFPGA/openflow/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-0r0b115b
cwd: /home/ram/repos_ram/PyFPGA/openflow/
Complete output (9 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/ram/repos_ram/PyFPGA/openflow/setup.py", line 3, in <module>
import openflow
File "/home/ram/repos_ram/PyFPGA/openflow/openflow/__init__.py", line 6, in <module>
from openflow.configure import ConfigureTools
File "/home/ram/repos_ram/PyFPGA/openflow/openflow/configure.py", line 25, in <module>
from yaml import safe_load, dump
ImportError: No module named 'yaml'
----------------------------------------
WARNING: Discarding file:///home/ram/repos_ram/PyFPGA/openflow. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
它在我的计算机中失败(我知道,python3.5已被弃用(,但在GitHub操作中也会失败(https://github.com/PyFPGA/openflow/pull/7/checks?check_run_id=2171303843)使用ubuntu-latest
(使用Python 3.6、3.7、3.8和3.9(
我不想有变通办法。我知道install_requires
是指定强制依赖项的方法。我错了?
提前感谢Rodrigo
我解决了我的问题。它与install_requires无关。为了阅读我的项目版本,我导入了导入yaml的文件(尚未安装(。因此,我避免在setup.py.中导入我的库