我有Python轮文件: psutil-5.4.5-cp26-none-linux_x86_64.whl
如何列出此轮具有的依赖关系?
尝试安装时出现以下错误psycopg2:
(venv) root@scw-determined-panini:/app# pip install psycopg2
Collecting psycopg2
Using cached https://files.pythonhosted.org/packages/a8/8f/1c5690eebf148d1d1554fc00ccf9101e134636553dbb75bdfef4f85d7647/psycopg2-2.8.5.tar.gz
Building wheels for collected packages: psycopg2
Running setup.py bdist_wheel for psycopg2 ... error
Complete output from command /app/venv/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-psll6xe_/psycopg2/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp52or8xexpip-wheel- --python-tag cp38:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extensions.py …Run Code Online (Sandbox Code Playgroud) 在使用过程中pip install tf-models-official,我在安装库时发现了以下问题:-
Collecting tf-models-official\n Using cached tf_models_official-2.8.0-py2.py3-none-any.whl (2.2 MB)\nRequirement already satisfied: Pillow in c:\\users\\user\\documents\\python scripts\\number_plate_recognition\\anprsys\\lib\\site-packages (from tf-models-official) (9.0.1)\nCollecting gin-config\n Using cached gin_config-0.5.0-py3-none-any.whl (61 kB)\nCollecting seqeval\n Using cached seqeval-1.2.2-py3-none-any.whl\nRequirement already satisfied: tensorflow~=2.8.0 in c:\\users\\user\\documents\\python scripts\\number_plate_recognition\\anprsys\\lib\\site-packages (from tf-models-official) (2.8.0)\nCollecting tensorflow-datasets\n Using cached tensorflow_datasets-4.5.2-py3-none-any.whl (4.2 MB)\nRequirement already satisfied: six in c:\\users\\user\\documents\\python scripts\\number_plate_recognition\\anprsys\\lib\\site-packages (from tf-models-official) (1.16.0)\nRequirement already satisfied: scipy>=0.19.1 in c:\\users\\user\\documents\\python scripts\\number_plate_recognition\\anprsys\\lib\\site-packages (from tf-models-official) (1.8.0)\nCollecting pandas>=0.22.0\n Using cached pandas-1.4.1-cp310-cp310-win_amd64.whl (10.6 MB)\nCollecting py-cpuinfo>=3.3.0\n Using cached py_cpuinfo-8.0.0-py3-none-any.whl\nCollecting google-api-python-client>=1.6.7\n Downloading google_api_python_client-2.42.0-py2.py3-none-any.whl (8.3 MB)\n …Run Code Online (Sandbox Code Playgroud) python python-wheel tensorflow automatic-license-plate-recognition sentencepiece
我认为这是一个简单的问题,但我还没有找到答案,所以我在这里发帖.
我有一个Python 3应用程序,我打包成一个平台轮.我有setup.py,一切都按预期工作.我唯一想知道的是生成的轮子总是包含一个ABI标签(如"cp34m"),当包含它时,我发现我实际上无法通过pip安装轮子.(我的构建脚本在运行之前会安装最新的pip,setuptools和wheel.)
解决方案很简单.我只需更改滚轮的文件名即可将"cp34m"更改为"none".这显然很容易添加到我的构建脚本中,但我想知道是否可以为bdist_wheel设置一个选项,以便生成的.whl文件没有自己设置?
我用来创建轮子的命令是(例如在x64上):
python setup.py bdist_wheel --plat-name win_amd64
这创造了一个像:
mpf_mc-0.30.0.dev269-cp34-cp34m-win_amd64.whl
然后在上传到PyPI之前重命名为:
mpf_mc-0.30.0.dev269-cp34-none-win_amd64.whl
通过手动重命名它似乎一切正常.但我想知道这是否是正确的方法,或者我错过了什么?
考虑通常的场景 - 我想创建一个虚拟环境并安装一些软件包。说
python3 -m venv venv
source venv/bin/activate
pip install databricks-cli
Run Code Online (Sandbox Code Playgroud)
在安装过程中,我收到错误
Building wheels for collected packages: databricks-cli
Building wheel for databricks-cli (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/paulius/Documents/wheeltest/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-m7jmyh1m/databricks-cli/setup.py'"'"'; __file__='"'"'/tmp/pip-install-m7jmyh1m/databricks-cli/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-maxix98x
cwd: /tmp/pip-install-m7jmyh1m/databricks-cli/
Complete output (8 lines):
/tmp/pip-install-m7jmyh1m/databricks-cli/setup.py:24: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp …Run Code Online (Sandbox Code Playgroud) 使用from setuptools.command.install import install,如果我运行,我可以轻松运行自定义安装后脚本python setup.py install.这是相当微不足道的.
目前,该脚本除了打印一些文本之外什么都不做,但我希望它能够处理安装新软件包时需要进行的系统更改 - 例如,备份软件包正在使用的数据库.
我想为我的包生成一个Python轮,然后将其复制并安装在一组部署机器上.但是,我的自定义安装脚本不再在部署计算机上运行.
我究竟做错了什么?这甚至可能吗?
我想分发一个完整的virtualenv,或者一堆具有运行时依赖性的精确版本的Python轮,例如:
我想我可以依赖系统安装libssl.so,但肯定不是正确版本的libcurl.so而且可能不是Kerberos.
在具有所有运行时依赖性的轮中打包一个库的最简单方法是什么?
或者这是一个傻瓜的差事,我应该打包整个virtualenv?如何可靠地做到这一点?
动态PS编译不是一种选择,一些模块是修补的.
我可以看到这里之前已经问过这个问题 tensorflow-has-no-attribute-compat
但给出的答案是
Microsoft Visual C++ 2015-2019 Redistributable (x64)
Run Code Online (Sandbox Code Playgroud)
它对前一个成员不起作用,对我也不起作用。我安装了 Visual Studio 2019。我还是下载了它并运行了(MV C++)的修复以防万一。仍然得到同样的错误。
话虽如此,我还没有在 google 或 stackoverflow 上的任何地方找到有效的解决方案。以下是我已安装的一些规范详细信息。
tensorflow-gpu 2.1
python 3.7.7
CUDA 10.1
Anaconda 3.7
Run Code Online (Sandbox Code Playgroud)
看起来 gpu 启动成功。
2020-06-28 07:19:47.851257: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
Run Code Online (Sandbox Code Playgroud)
3.7.7 的 python 包。通过 pip 安装的所有软件包。仅通过 conda 安装了 tensorflow。不要认为这有什么不同。我使用 conda 所以我可以指定安装版本 2.1,pip 会自动安装 2.2。
Package Version
---------------------- ----------------------------
absl-py 0.9.0
appdirs 1.4.4
astor 0.7.1
astroid 2.4.2
astropy 4.0.1.post1
attrs 19.3.0
backcall 0.2.0
bayesian-optimization 1.2.0
black 19.10b0
bleach 3.1.5
blinker 1.4
brotlipy …Run Code Online (Sandbox Code Playgroud) 这是项目目录结构
\n.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 meow.py\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 pyproject.toml\n\n0 directories, 2 files\nRun Code Online (Sandbox Code Playgroud)\n这是meow.py:
def main():\n print("meow world")\nRun Code Online (Sandbox Code Playgroud)\n这是pyproject.toml:
[build-system]\nrequires = ["setuptools"]\nbuild-backend = "setuptools.build_meta"\n\n[project]\nname = "meowpkg"\nversion = "0.1"\ndescription = "a package that meows"\n\n[project.scripts]\nmeow_world = "meow:main"\nRun Code Online (Sandbox Code Playgroud)\n构建此包时,无论是使用python3 -m pip wheel .还是使用python3 -m build,都会创建一个名为 like 的文件meowpkg-0.1-py3-none-any.whl,该文件无法安装在 Python 2 上。
$ python2.7 -m pip install meowpkg-0.1-py3-none-any.whl\nERROR: meowpkg-0.1-py3-none-any.whl is not a supported wheel on this platform.\nRun Code Online (Sandbox Code Playgroud)\n但“meowpkg”实际上也适用于 Python 2。如何指示 setuptools 和/或 Wheel …
我有一个简单的 python 包,我们称之为my_package。
它的文件位于src/python/my_package.\n此外,存储库根目录中有一个data文件夹,该文件夹应包含在my_package.
.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 python\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 my_package\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 data\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 stuff.json\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 pyproject.toml\nRun Code Online (Sandbox Code Playgroud)\n我没有找到任何方法来配置诗歌,它data以正确的方式包含附加文件夹。
这是我的pyproject.toml
[tool.poetry]\nname = "my-package"\nversion = "2.10.0" \n\npackages = [\n { include = "my_package", from = "src/python" }\n]\n\n# This does not work! It puts the `data` folder into site-packages/data instead of site-packages/my_package/data\ninclude = [\n { path = "data", format = ["sdist", "wheel"] }\n]\n\n[build-system]\nrequires = ["poetry-core>=1.0.0"]\nbuild-backend = "poetry.core.masonry.api"\nRun Code Online (Sandbox Code Playgroud)\n我还使用预构建脚本找到了以下解决方案:\n https://github.com/python-poetry/poetry/issues/5539#issuecomment-1126818974 …
python ×10
python-wheel ×10
pip ×4
setuptools ×2
tensorflow ×2
automatic-license-plate-recognition ×1
psycopg2 ×1
python-2.7 ×1
python-3.x ×1