小编Kal*_*ana的帖子

命令出错,退出状态为 1:python setup.py egg_info 检查日志以获取完整的命令输出 - 同时通过 pip 安装 auto-py-to-exe

我正在尝试在不同于我通常通过 pip 使用的(Windows)设备上下载 auto-py-to-exe。但是,运行时出现错误(对不起,它太长了):

ERROR: Command errored out with exit status 1:
     command: 'c:\users\tom\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\tom\\AppData\\Local\\Temp\\pip-install-aplljhe0\\gevent\\setup.py'"'"'; __file__='"'"'C:\\Users\\tom\\AppData\\Local\\Temp\\pip-install-aplljhe0\\gevent\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\tom\AppData\Local\Temp\pip-install-aplljhe0\gevent\pip-egg-info'
         cwd: C:\Users\tom\AppData\Local\Temp\pip-install-aplljhe0\gevent\
    Complete output (113 lines):
    Traceback (most recent call last):
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 489, in _find_latest_available_vc_ver
        return self.find_available_vc_vers()[-1]
    IndexError: list index out of range

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
        yield saved
      File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\sandbox.py", …
Run Code Online (Sandbox Code Playgroud)

python cmd pip

30
推荐指数
2
解决办法
15万
查看次数

git 中的全局配置和本地配置有什么区别?

我是 Git 的初学者。我通过互联网找到那些。

我所知道的是

  • 本地-:此文件中的值适用于单个存储库。
  • 全局-:此文件中的配置值应用于单个用户。

我可以知道这些配置之间的任何其他差异吗?

git git-config

14
推荐指数
3
解决办法
6680
查看次数

合并散列删除算法

有人可以向我展示一个合并链式哈希表的删除算法示例吗?

我的插入算法是这样的:

Insert (key) 
    int p = hash(key)
    if d[p] = NIL then
        d[p] = key
        next[p] = NIL
    else
        while next[p] != NIL 
            p = next[p]
        endwhile
        td[firstEmpty] = key
        next[p] = firstEmpty
        next[firstEmpty] = NIL
    endif
    UpdateFirstEmpty(); //sets firstEmpty to first empty slot with lowest index
endInsert
Run Code Online (Sandbox Code Playgroud)

假设表中的槽数为 13。散列函数返回Key%13

    Keys | 5 | 18 | 16 | 15 | 13 | 31 | 26 |      
Hash(key)| 5 |  5 |  3 |  2 |  0 | …
Run Code Online (Sandbox Code Playgroud)

algorithm hash pseudocode

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

Typescript 中的模数(%)运算符对于大数字无法正常工作

我正在编写一个特定的验证器,需要 16 位数字的模数。请注意,运算符 % 在 15 位数字之后无法正常工作。我可以重写我的代码以检查更少的数字,但我在文档中的任何地方都找不到此限制。造成这个效果不好的原因是什么?

尝试在普通 .ts 文件中检查这些值:

console.log(10000000000000000%97); 

console.log(10000000000000001%97);

console.log(10000000000000002%97);

console.log(10000000000000003%97);

console.log(10000000000000004%97);
Run Code Online (Sandbox Code Playgroud)

使用常规计算器时的预期结果是:

62
63
64
65
66
Run Code Online (Sandbox Code Playgroud)

另一方面,输出是:

62
62
64
66
66
Run Code Online (Sandbox Code Playgroud)

operators modulo modulus typescript

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

如何从列表中的整数中删除重复的数字

我有这个清单

names = [ ["cat", 9112, "dog123", 5625], ["luck", 1232, "bad23"] ]
Run Code Online (Sandbox Code Playgroud)

根据这个问题, 我使用这段代码完成了

names = [ ["cat", 9112, "dog123", 5625], ["luck", 1232, "bad23"] ]
new = [[x for x in y if isinstance(x, int)] for y in names]
Run Code Online (Sandbox Code Playgroud)

输出 -: [[9112, 5625], [1232]]


问题

现在我想删除这样的重复数字。

expected output -: [[912, 562], [123]]
Run Code Online (Sandbox Code Playgroud)

我正在使用此代码但它不起作用

m = sorted(list(set(new)))
print(m)
Run Code Online (Sandbox Code Playgroud)

错误 -:

Traceback (most recent call last):    
   File "main.py", line 13, in <module>     
     m = sorted(list(set(new)))     
TypeError: unhashable type: 'list'
Run Code Online (Sandbox Code Playgroud)

注意 -: …

python list python-3.x

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

在后台发出颤动的声音警报,并在点击通知时取消

在后台发出颤动的声音警报,并在单击通知时取消。

我正在尝试创建一个用于测试/学习颤振的基本警报应用程序。我的应用程序的高级设计如下所示:

创建警报:

(A)。用户创建警报
(b)。我使用 android_alarm_manager 来安排闹钟
(c)。在闹钟回调中,我使用 FlutterRingtonePlayer.playAlarm()
(d)。用于flutter_local_notification在闹钟响起时显示通知,以便用户可以取消闹钟。

当用户点击通知时:

  • 我收到 的回调flutter_local_notification,它打开了应用程序。

  • FlutterRingtonePlayer.stop()这样做了,但这并不能阻止警报。

它现在不起作用,因为FlutterRingtonePlayer当应用程序从通知再次启动时会再次构建。

我能想到的可能的解决方案是:

  1. 以某种方式保留FlutterRingtonePlayer在手机的共享内存中,以便我可以在取消闹钟时重复使用它。也许以某种方式序列化它?
  2. 想办法让手机在那一刻停止所​​有的声音。

还有更多吗?有更好的方法来做到这一点吗?

Here is my code:

--------------- Scheduling alarm -----------------------------------

void scheduleAlarm(Alarm alarm) {
  alarm.alarmTime =
      getUpdatedAlarmDateTime(TimeOfDay.fromDateTime(alarm.alarmTime));

  AndroidAlarmManager.oneShot(
      alarm.alarmTime.difference(DateTime.now()), alarm.alarmId, soundAlarm,
      wakeup: true, alarmClock: true, rescheduleOnReboot: true);
}

void soundAlarm(int alarmId) async {
  var androidPlatformChannelSpecifics = AndroidNotificationDetails(
      'your channel id', 'your channel name', 'your channel description',
      importance: Importance.Max, priority: Priority.High, ticker: 'ticker');
  var …
Run Code Online (Sandbox Code Playgroud)

java dart flutter

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

我需要创建一个已创建主题的 kafka 图像

我有一个要求,我需要在本地设置 kafka,主题已经存在于容器中。我正在使用它ladoop/fast-data-dev来做到这一点

我是如何手动做的-

docker run -d --name landoopkafka -p 2181:2181 -p 3030:3030 -p 8081:8081 -p 8082:8082 -p 8083:8083 -p 9092:9092 -e ADV_HOST=localhost landoop/fast-data-dev
Run Code Online (Sandbox Code Playgroud)

运行此命令后,我的容器已启动并正在运行。

现在我像 docker -exec -it landopkafka bash 一样进入这个容器内的 bash

并使用此命令创建主题

kafka-topics --zookeeper localhost:2181 --create --topic hello_topic --partitions 1 --replication-factor 1
Run Code Online (Sandbox Code Playgroud)

我的主题已创建。

但我的要求是我需要一个 docker 文件,该文件将创建主题,我只需要运行它。

或者

我需要运行的 docker compose 文件

伙计们,我需要这方面的帮助,因为我对 docker 和 kafka 完全陌生

apache-kafka docker dockerfile docker-compose

5
推荐指数
2
解决办法
5297
查看次数

测试规则 AlertManager 失败:yaml:解组错误:第 1 行:在类型 main.unitTestFile 中找不到字段组

请帮助我在下面测试警报管理器时收到错误消息

 promtool check rules /etc/prometheus/alert.rules.yml
 Checking /etc/prometheus/alert.rules.yml
 SUCCESS: 3 rules found

 promtool test rules /etc/prometheus/alert.rules.yml
 Unit Testing:  /etc/prometheus/alert.rules.yml
 FAILED:
 yaml: unmarshal errors:
 line 1: field groups not found in type main.unitTestFile
Run Code Online (Sandbox Code Playgroud)

我的alert.rules配置如下:

      cat /etc/prometheus/alert.rules.yml
      groups:
      - alert: MemoryFree10%
        expr: node_exporter:node_memory_free:memory_used_percents >= 90
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "Instance {{ $labels.instance }} hight memory usage"
          description: "{{ $labels.instance }} has more than 90% of its memory used."
      - alert: DiskSpace10%Free
        expr: node_exporter:node_filesystem_free:fs_used_percents >= 90
        labels:
          severity: …
Run Code Online (Sandbox Code Playgroud)

alert prometheus prometheus-alertmanager

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

PIP 加密安装失败

这个问题有很多答案,涵盖了大量不同的场景,但我还没有找到解决同样问题的方法。当我尝试安装pip install cryptography 时,我得到:

生成 cffi 模块 'build\temp.win-amd64-3.8\Release\_padding.c' 创建 build\temp.win-amd64-3.8 创建 build\temp.win-amd64-3.8\Release
生成 cffi 模块 'build\temp. win-amd64-3.8\Release\_constant_time.c' 生成 cffi 模块 'build\temp.win-amd64-3.8\Release\_openssl.c'
构建 '_openssl' 扩展创建 build\temp.win-amd64-3.8\Release\ build 创建 build\temp.win-amd64-3.8\Release\build\temp.win-amd64-3.8 创建 build\temp.win-amd64-3.8\Release\build\temp.win-amd64-3.8\Release
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\be004cr\PycharmProjects\SSLTest\venv\include -IC:\Python\Python38\include -IC:\Python\Python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\ Professional\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include" "-IC :\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\ Program Files (x86) \Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows …

python pip pycharm python-cryptography

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

无法安装mysqlclient

我在 Django 框架中使用 python3.8,为此我必须安装 mysqlclient。但是当我尝试时错误来了

pip3 install mysqlclient
Run Code Online (Sandbox Code Playgroud)

像这样输出为错误。

Collecting mysqlclient
  Using cached https://files.pythonhosted.org/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /home/LPython/my_env/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fgg27tgk/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fgg27tgk/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-fgg27tgk/mysqlclient/pip-egg-info
         cwd: /tmp/pip-install-fgg27tgk/mysqlclient/
    Complete output (11 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/LPython/my_env/lib/python3.8/site-packages/setuptools/__init__.py", line 20, in <module>
        from setuptools.dist import Distribution, Feature
      File "/home/LPython/my_env/lib/python3.8/site-packages/setuptools/dist.py", line 35, in <module>
        from setuptools import windows_support
      File …
Run Code Online (Sandbox Code Playgroud)

python mysql pip

5
推荐指数
2
解决办法
4331
查看次数