小编Red*_*Rum的帖子

当 pip 依赖解析器想要使用应用程序的冲突 djangoplotly dash 版本时该怎么办?

所以我正在尝试与我的 django 应用程序集成,但是我在渲染图表时遇到问题。我使用的是 VSCode,它没有发现依赖冲突。

然而当我开始使用 Pycharm 时。它说我的 Dash 版本是 1.11,它满足 django-plotly-dash,但不满足需要 2.0.0 的 dash_bootstrap_components

我现在已经安装了 Dash 版本 1.10,它与两个应用程序冲突,只是为了显示以下错误消息:

相关错误代码

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following de
pendency conflicts.
django-plotly-dash 1.6.6 requires dash<1.21.0,>=1.11, but you have dash 1.10.0 which is incompatible.
dash-bootstrap-components 1.0.3 requires dash>=2.0.0, but you have dash 1.10.0 which is incompatible.
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏

回答

由于 django-plotly-dash 是最新版本,我决定安装 dash 1.20 并通过 dash-bootstrap-components 降级到 …

python django plotly plotly-dash

9
推荐指数
1
解决办法
6万
查看次数

PIP 无法构建包 cytoolz

我正在尝试使用“pipx install eth-brownie”安装 eth-brownie,但收到一条错误消息

pip failed to build package: cytoolz
Some possibly relevant errors from pip install:
    build\lib.win-amd64-3.10\cytoolz\functoolz.cp310-win_amd64.pyd : fatal error LNK1120: 1 unresolved externals
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\link.exe' failed with exit code 1120
Run Code Online (Sandbox Code Playgroud)

我查看了日志文件,它显示它无法构建 cytoolz。它还提到“警报:未安装 Cython。不使用 Cython 进行构建。”。根据我有限的理解,Cytoolz 是 Cython 的一部分,所以我认为 eth-brownie 安装失败的原因是它无法构建 cytoolz,因为它试图在没有 Cython 的情况下构建它。问题是我已经安装了 cython:

C:\Users\alaiy>pip install cython
Requirement already satisfied: cython in c:\python310\lib\site-packages (0.29.24)
Run Code Online (Sandbox Code Playgroud)

从日志文件中摘录(我可以粘贴整个内容,但它很长):

Building wheels for collected packages: bitarray, cytoolz, lru-dict, parsimonious, psutil, pygments-lexer-solidity, varint, websockets, wrapt
  Building wheel for bitarray …
Run Code Online (Sandbox Code Playgroud)

python pip cython web3py

8
推荐指数
1
解决办法
1万
查看次数

AWS Cross-Origin-Opener-Policy 标头已被忽略,因为 URL 的来源不可信

我已经在 EC2 实例上启动了 django 应用程序,并将静态文件(css、js 等)添加到 S3 存储桶中。昨晚经过几个小时后,当我查看 EC2 公共地址 Happy days 时,我设法将静态图像加载到页面上。

但现在我不断收到此错误:当我查看检查网页时,我不断收到此错误“Cross-Origin-Opener-Policy 标头已被忽略,因为 URL 的来源不可信。它是在最终响应中定义的,或者重定向。请使用 HTTPS 协议传递响应。您也可以使用“localhost”源”

我的静态图像都没有加载。我在网上找不到与此确切错误消息相关的任何内容,有一些变体会导致死胡同。有谁知道发生了什么事吗?

奇怪的是,如果我在个人电脑上运行 django 应用程序,那么当我检查时不会显示错误,但静态图像也不会加载。

当我在 ec2 实例上运行 django 应用程序时,我收到错误消息,其中静态图像仍未加载。所以我不认为该错误会影响静态图像的加载,即它们是两个独立的问题。

但昨晚所有这些都在起作用,所以我不知道发生了什么。

django amazon-s3 amazon-ec2 amazon-web-services

6
推荐指数
1
解决办法
3926
查看次数

如何从元组列表中删除第一个元素?

我有一个元组列表,如下所示:

x = [("a","b","c"), ("d","e","f"), ("g","h","i"), ("j","k","l")]
Run Code Online (Sandbox Code Playgroud)

我想从每个索引中删除第一个元素,如下所示:

x = [("b","c"), ("e","f"), ("h","i"), ("k","l")]
Run Code Online (Sandbox Code Playgroud)

我尝试过使用pop.xand remove.xlike so 这不起作用。我认为是因为列表中有无法更改的元组?:

for i in result:
    i.pop(0)
Run Code Online (Sandbox Code Playgroud)

所以我尝试使用函数将元组列表转换为列表列表,zip但出现错误:

AttributeError: type object 'zip' has no attribute 'result'
Run Code Online (Sandbox Code Playgroud)

有什么想法我做错了吗?

感谢所有有用的答案!有很多给猫剥皮的方法,我可以用它们来解决我遇到的其他问题=D

python

0
推荐指数
1
解决办法
659
查看次数