小编Sab*_* 錆兎的帖子

Pyinstaller:AttributeError:模块“enum”没有属性“IntFlag”

我需要将python代码编译为exe。我找到了一些如何做到这一点的指南,其中要求我为此安装 PyInstaller:

pip install --upgrade pyinstaller
Run Code Online (Sandbox Code Playgroud)

但我收到下一个错误:

C:\Users\alonat>pip install pyinstaller
Collecting pyinstaller
  Using cached PyInstaller-3.6.tar.gz (3.5 MB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\alonat\appdata\local\programs\python\python37-32\python.exe' 'c:\users\alonat\appdata\local\programs\python\python37-32\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\alonat\AppData\Local\Temp\pip-build-env-yo59g2oq\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel
       cwd: None
  Complete output (14 lines):
  Traceback (most recent call last):
    File "c:\users\alonat\appdata\local\programs\python\python37-32\lib\runpy.py", line 193, in _run_module_as_main
      "__main__", mod_spec)
    File "c:\users\alonat\appdata\local\programs\python\python37-32\lib\runpy.py", line 85, in _run_code
      exec(code, run_globals)
    File "c:\users\alonat\appdata\local\programs\python\python37-32\lib\site-packages\pip\__main__.py", line 23, in …
Run Code Online (Sandbox Code Playgroud)

python pip pyinstaller

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

在默认构造函数中声明 arr 时,未在此范围内声明“arr”

我是 C++ 的新手。我正在尝试实现一个堆栈。我arr默认构造函数中声明了一个命名变量。

但是当我编译我的代码时,我收到一条错误消息

'arr' was not declared in this scope
Run Code Online (Sandbox Code Playgroud)

我的代码:

#include<iostream>
using std::cout;
using std::endl;
using std::cin;

class Stack
{

private:
    int top = -1;
    int n = 100;

public:
    Stack()
    {
        int arr[n]; // 100 element stack
    }

    void push(int element)//push element to the top of the stack
    {
        if (isFull() == false)
        {
            // push element
            top += 1; //increment top
            arr[top] = element;
        }
        else cout << "\nStack is …
Run Code Online (Sandbox Code Playgroud)

c++ constructor class class-members c++11

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

为什么我的插页式测试广告没有显示?

我按照 admob 网站的要求编写了脚本,但没有显示任何内容

\n

我尝试了不同的活动,48小时,还没有结果

\n

我收到错误

\n
E/AndroidRuntime: FATAL EXCEPTION: main\n    Process: com.isotronic.adesivoschaves, PID: 1065\n    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.isotronic.adesivoschaves/com.example.samplestickerapp.StickerPackDetailsActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.gms.ads.interstitial.InterstitialAd.setFullScreenContentCallback(com.google.android.gms.ads.FullScreenContentCallback)' on a null object reference\n        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3488)\n        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3635)\n        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)\n        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)\n        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)\n        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2175)\n        at android.os.Handler.dispatchMessage(Handler.java:107)\n        at android.os.Looper.loop(Looper.java:237)\n        at android.app.ActivityThread.main(ActivityThread.java:7860)\n        at java.lang.reflect.Method.invoke(Native Method)\n        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)\n        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)\n     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.gms.ads.interstitial.InterstitialAd.setFullScreenContentCallback(com.google.android.gms.ads.FullScreenContentCallback)' on a null object reference\n        at com.example.samplestickerapp.StickerPackDetailsActivity.onCreate(StickerPackDetailsActivity.java:131)\n        at android.app.Activity.performCreate(Activity.java:7955)\n        at …
Run Code Online (Sandbox Code Playgroud)

ads interstitial admob

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

错误:未知选项 '--output' React &amp; Django

在我的 package.json 文件中,我有:

  "scripts": {
    "dev": "webpack --mode development ./x/frontend/src/index.js --output  ./x/frontend/static/frontend/main.js",
    "build": "webpack --mode production ./x/frontend/src/index.js --output ./x/frontend/static/frontend/main.js"
  },
Run Code Online (Sandbox Code Playgroud)

当我尝试运行此命令时:npm run build它显示了一个错误:[webpack-cli] Error: Unknown option '--output'

我怎样才能解决这个问题?

reactjs webpack

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

如何使用蛮力匹配/SIFT 描述符获取匹配点的位置

我尝试将我的 SIFT-Keypoints 与 BF-matcher 匹配。我用来做它喜欢这样

但是如果我想得到 x,y 位置,print(good)它只会给我这样的东西:

DMatch 000001DD9C4E0EB0

如何将其转换为职位?

python opencv sift

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

Firebase 在中国仍然被屏蔽?

我不知道我的应用程序是否可以在中国运行,也不知道如何测试它。我在某处读到有一个 firebase 中文域名 .cn 正在运行。如果还没有的话,是否有可能将当前项目转移到中文域并使其运行?

如果我创建一个新项目并为我的 Firebase 服务选择中国服务器,那么它会对世界其他地区产生任何其他不利后果吗?这个解决方案实际上会迫使所有开发人员将 Firebase 服务器设在中国,这样他们就不会错过中国用户群,我认为这对某些人来说可能是一个问题。

我可能没有最好的想法,但任何建议和解决方法将不胜感激。

firebase firebase-authentication great-firewall-of-china google-cloud-firestore

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

为什么我在 C++ 中开始出现“max”:未找到标识符错误?

我最近开始收到此错误。这部分代码工作正常,但在对项目的其他(大部分不相关)部分进行较大更改后突然停止工作。

我已经包含windows.h并包含了两者stdlb.h,并且还尝试手动定义它,但仍然出现错误。请注意,ctrl+ right clickonmax()在 Visual Studio 中找到 3 个匹配项(我的定义、stdlib 和 minwindef),但不会跳转到一个。

#define max(a, b) (((a) > (b)) ? (a) : (b))

我的代码看起来像这样

#define MYMAX(a, b) max(a, b)
...
return MYMAX(indexa, indexb);
...
Run Code Online (Sandbox Code Playgroud)

使用std::max(indexa, indexb)修复了问题,但仍然想知道为什么之前的代码突然停止工作。

c++

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

具有空安全性的 Flutter 条件渲染

如果过期不为空,我想渲染文本小部件。所以我检查了 null

但出现错误

在此输入图像描述

class TileButton extends StatelessWidget {
  final DateTime? expires;

  const TileButton({
    Key? key,
    this.expires,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Text(
          'Hello Flutter',
        ),
        if (expires != null)
          Text(
            expires.day.toString(),
          ),
      ],
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

dart flutter dart-null-safety

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

模型序列化器销毁方法

我有一个名为的模型Profile,它是 Django 模型的包装器UserProfileSerializer现在,我通过以下方式创建了一个:

class UserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = ('first_name', 'last_name', 'email', 'password')

class ProfileSerializer(serializers.ModelSerializer):
    user = UserSerializer(required=True)

    def create(self, validated_data):
        user_data = validated_data.pop('user')
        user = User.objects.create_user(**user_data, username=validated_data.get('username'))
        profile = Profile.objects.create(user=user, **validated_data)
        return profile
    
    def update(self, instance, validated_data):
        instance.dob = validated_data.get('dob', instance.dob)
        instance.karma = validated_data.get('karma', instance.karma)
        instance.username = validated_data.get('username', instance.username)
        user_data = validated_data.pop('user')
        instance.user.first_name = user_data.get('first_name', instance.user.first_name)
        instance.user.last_name = user_data.get('last_name', instance.user.last_name)
        instance.user.email = user_data.get('email', instance.user.email)
        instance.user.username = instance.username
        new_password = user_data.get('password') …
Run Code Online (Sandbox Code Playgroud)

django serialization http-delete

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

如何在C中舍入一个数字?

我尝试在 Stack Overflow 上搜索,但找不到答案。

这是代码:

#include <stdio.h>

int main(void) {
 

double y;
printf("Enter a number: ");
scanf("%lf", &y);
printf("Your number when rounded is: %.2lf", y); 
//If user inputs 5.05286, how can i round off this number so as to get the output as 5.00
//I want the output to be rounded as well as to be 2 decimal places like 10.6789 becomes 11.00


return 0;
}
Run Code Online (Sandbox Code Playgroud)

我想对一个数字进行四舍五入,例如,如果数字是5.05286,则应四舍五入为5.00,如果是5.678901,则将四舍五入到6.002小数位。数字5.678901正在四舍五入,5.05 …

c rounding

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

CSS 选择器中的句点

使用各种选择器配置的含义是什么?

  1. span.classy.whatever { }
  2. span.classy, .whatever { }
  3. span .classy .whatever { }
  4. span, .classy, .whatever { }

css css-selectors

-1
推荐指数
1
解决办法
3357
查看次数

Django 中的中间模型有什么用?

为什么我们使用中间模型? 我们不能在没有中间模型的情况下使用多对多关系吗?

python django django-models

-1
推荐指数
1
解决办法
1148
查看次数