小编Slo*_*ela的帖子

Conda:concurrent.futures.process.BrokenProcessPool:进程池中的进程在 future 正在运行或挂起时突然终止

我想在我的 Mac 上安装 Anaconda(版本 10.9.5)。

我使用的命令:

sh Anaconda3-2020.02-MacOSX-x86_64.sh 
Run Code Online (Sandbox Code Playgroud)

导致了这个错误:

Unpacking payload ...
Traceback (most recent call last):                                                                                                                                  
  File "entry_point.py", line 69, in <module>
  File "concurrent/futures/process.py", line 483, in _chain_from_iterable_of_lists
  File "concurrent/futures/_base.py", line 598, in result_iterator
  File "concurrent/futures/_base.py", line 435, in result
  File "concurrent/futures/_base.py", line 384, in __get_result
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
[1061] Failed to execute script entry_point
Run Code Online (Sandbox Code Playgroud)

经过一番搜索后,我发现了这个建议,即检查哈希值。

我输入了这个:

shasum -a 512 /Users/Slowat/Anaconda3-2020.02-MacOSX-x86_64.sh 
Run Code Online (Sandbox Code Playgroud)

输出是:

aa1ed0c40646ba9041abf59c13ce38da1dc51bf15de239b6f966a0b02b4c09c960ae33698c72aa46db41731f8e67938d1972fcb76fa4c5c8081bc0272bb1b535 …
Run Code Online (Sandbox Code Playgroud)

python anaconda

9
推荐指数
2
解决办法
9587
查看次数

创建并附加到SQLAlchemy数据库表中的列表

我正在学习SQLAlchemy而且我被困住了.我有一个SQL表(table1)有两个字段:'name'和'other_names'

我有一个包含两列的excel文件:

first_name alias   
paul   patrick
john   joe
simon  simone
john   joey
john   jo
Run Code Online (Sandbox Code Playgroud)

我想将excel文件读入我的table1,所以它看起来像这样(即同一行的所有别名都在一行):

paul    patrick
john    joe,joey,jo
simon   simone
Run Code Online (Sandbox Code Playgroud)

这是我试图做的想法.我试过的代码(带注释):

for line in open('file.txt', 'r'): #for each line in the excel file
        line = line.strip().split('\t') #split each line with a name and alias
        first_name = line[0] #first name is the name before the tab
        alias = line[1] #alias is the name after the tab
        instance = 
        Session.query(session,tbs['table1'].name).filter_by(name=first_name) #look through the database table, by name field, and see if …
Run Code Online (Sandbox Code Playgroud)

python sql sqlalchemy

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

PyLaTeX:pylatex.errors.CompilerError:未找到 LaTex 编译器

我正在尝试从这里运行确切的代码以获得 pylatex 工作的示例。

在我正在工作的目录中,我从链接中复制并粘贴了:

from pylatex import Document, Section, Subsection, Command
from pylatex.utils import italic, NoEscape
import pdflatex


def fill_document(doc):
    """Add a section, a subsection and some text to the document.

    :param doc: the document
    :type doc: :class:`pylatex.document.Document` instance
    """
    with doc.create(Section('A section')):
        doc.append('Some regular text and some ')
        doc.append(italic('italic text. '))

        with doc.create(Subsection('A subsection')):
            doc.append('Also some crazy characters: $&#{}')


if __name__ == '__main__':
    # Basic document
    doc = Document('basic')
    fill_document(doc)

    doc.generate_pdf(clean_tex=False,compiler='pdflatex')
    doc.generate_tex()

    # Document with `\maketitle` command …
Run Code Online (Sandbox Code Playgroud)

python latex pylatex

7
推荐指数
1
解决办法
2057
查看次数

Python热图:更改颜色图并使其不对称

我想建立此数据的热图:

curation1       curation2       overlap
1      2      0
1      3      1098
1      4      11
1      5      137
1      6      105
1      7      338
2      3      351
2      4      0
2      5      1
2      6      0
2      7      0
3      4      132
3      5      215
3      6      91
3      7      191
4      5      6
4      6      10
4      7      19
5      6      37
5      7      95
6      7     146
Run Code Online (Sandbox Code Playgroud)

我用以下代码制作了一个热图:

import sys
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.ticker as …
Run Code Online (Sandbox Code Playgroud)

python matplotlib heatmap pandas

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

selenium.common.exceptions.SessionNotCreatedException:消息:未创建会话:ChromeDriver Chrome Selenium 没有匹配功能错误

首先,机器和包装规格:我正在运行:

ChromeDriver version 75.0.3770.140
Selenium: version '3.141.0'
WSL (linux subsystem) of windows 10
Run Code Online (Sandbox Code Playgroud)

我正在尝试通过 Selenium 运行 chrome 浏览器。我发现:这些命令,通过谷歌浏览器使用硒。

我有一个测试目录,其中仅包含 chromedriver 二进制文件和脚本。目录位置为:/home/kela/test_dir/

我运行了代码:

import selenium
from selenium import webdriver
from bs4 import BeautifulSoup
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities


options = Options()
options.binary_location='/home/kela/test_dir/chromedriver'
driver = webdriver.Chrome(chrome_options = options,executable_path='/home/kela/test_dir/chromedriver')
Run Code Online (Sandbox Code Playgroud)

该代码的输出是:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: No matching capabilities found
Run Code Online (Sandbox Code Playgroud)

谁能解释为什么当同一个脚本适用于其他没有功能的脚本时我需要功能?我确实尝试添加:

chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
Run Code Online (Sandbox Code Playgroud)

但我得到了同样的错误。所以我不确定我需要添加哪些功能(考虑到它对没有它的其他人也适用?)

编辑 1:解决 DebanjanB 的以下评论:

  1. Chromedriver 位于预期位置。我使用的是 Windows 10。从这里开始,预期位置是 C:\Program …

selenium google-chrome webdriver selenium-chromedriver selenium-webdriver

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

在Python中绘制实际设置的项目,而不是项目的数量

我写了这个小函数:

def sets():
    set1 = random.sample(range(1, 50), 10)
    set2 = random.sample(range(1, 50), 10)
    return(set1,set2)

sets()
Run Code Online (Sandbox Code Playgroud)

该函数的输出如下所示:

([24, 29, 43, 42, 45, 28, 26, 3, 8, 21],
 [22, 37, 38, 44, 25, 42, 29, 7, 35, 9])
Run Code Online (Sandbox Code Playgroud)

我想用双向维恩图来绘制它。我知道如何使用 matplotlib 绘制集合之间重叠的数量,即使用这个确切的代码;但是我想在图中绘制实际值。

即两者之间的重叠应为:29,42,因为这是两个共同项,而不是数字 2,来表示重叠数字的数量。

有人知道该怎么做吗?

python matplotlib

3
推荐指数
1
解决办法
1083
查看次数

如何更改形状摘要图上的轴

我正在遵循此处列出的代码,只是值略有不同(因此我的代码与链接中描述的完全相同)。

我的输出如下所示:

在此输入图像描述

有人能够向我展示如何更改 X 轴(最好是自动更改,因为我必须为不同的数据集绘制多个图),以便数据不那么聚集并且可以看到完整的图?

python matplotlib shap

3
推荐指数
1
解决办法
5534
查看次数