【发布时间】:2022-01-25 11:51:30
【问题描述】:
我刚刚 fork minimalmodbus 来定制一些东西。通常我对自己的包所做的就是使用pip install -e bla 安装它们,这样我就可以生动地更改代码。我试图用这个叉子以这种方式进行,但我得到了
ERROR: File "setup.py" not found. Directory cannot be installed in editable mode: /home/me/code/repos/minimalmodbus
(A "pyproject.toml" file was found, but editable mode currently requires a setup.py based build.)
在这种情况下该怎么做?一种可能性是更改代码,然后重新安装包、测试、重新安装、测试等。但这很乏味,我认为开发人员不会以这种方式工作,每次他们想测试一行代码时都重新安装包。
我尝试了this 但不起作用,我收到错误
$ pip3 install -e repos/minimalmodbus/
Obtaining file:///home/tct/code/repos/minimalmodbus
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: pyserial>=3.0 in /home/tct/.local/lib/python3.8/site-packages (from minimalmodbus==2.0.1) (3.5)
Installing collected packages: minimalmodbus
Running setup.py develop for minimalmodbus
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/tct/code/repos/minimalmodbus/setup.py'"'"'; __file__='"'"'/home/tct/code/repos/minimalmodbus/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix=
cwd: /home/tct/code/repos/minimalmodbus/
Complete output (22 lines):
running develop
/tmp/pip-build-env-zcfd8ndi/overlay/lib/python3.8/site-packages/setuptools/command/easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
WARNING: The user site-packages directory is disabled.
/tmp/pip-build-env-zcfd8ndi/overlay/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/lib/python3.8/site-packages'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/lib/python3.8/site-packages/
This directory does not currently exist. Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/tct/code/repos/minimalmodbus/setup.py'"'"'; __file__='"'"'/home/tct/code/repos/minimalmodbus/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix= Check the logs for full command output.
如果我这样做pip3 install,它会完美运行。现在我正在使用蛮力pip3 install --upgrade --force-reinstall repos/minimalmodbus/; python3 my_code.py。
【问题讨论】: