致命错误:Python.h:没有那个文件或目录

在使用pip安装scrapy时发现以下错误:原因是没有安装python 的dev包

 

查看python 的dev包。由于我的python3使用yum安装的包为python36u

查看对应的开发包:【查询后根据自己安装的python版本来选择】

yum search python3 | grep dev

 

安装:【查询后根据自己安装的python来选择安装 python-dev】

sudo yum install python36u-devel

 

最后安装scrapy:问题解决!

 

git运行突然提示 Auto packing the repository in background for optimum performance

git运行突然提示
Auto packing the repository in background for optimum performance.
See “git help gc” for manual housekeeping.
error: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log.
Automatic cleanup will not be performed until the file is removed.

fatal: object 0e6e9b9ea821b1f859f9e2cab931ad8c00194daf cannot be read
error: failed to run repack

查资料,原来是自己本地一些 “悬空对象”太多(git删除分支或者清空stash的时候,这些其实还没有真正删除,成为悬空对象,我们可以使用merge命令可以从中恢复一些文件)

解决:

1.输入命令:git fsck --lost-found,可以看到好多“dangling commit”
2.清空他们:git gc --prune=now,完成

 

running gradle task assembledebug stuck

Here is solution in my case.

  1. Open your flutter Project directory.
  2. Change directory to android directory in your flutter project directory cd android
  3. clean gradle ./gradlew clean
  4. Build gradle ./gradlew build or you can combine both commands with just ./gradlew clean build (Thanks @daniel for the tip)
  5. Now run your flutter project. If you use vscode, press F5. First time gradle running assembleDebug will take time.

PS: Delete gradle in case of all that steps don’t work

CentOS 7 yum安装 RabbitMQ

方法 一
1、下载 erlang

wget http://www.rabbitmq.com/releases/erlang/erlang-19.0.4-1.el7.centos.x86_64.rpm
2、安装 erlang

rpm -ivh erlang-19.0.4-1.el7.centos.x86_64.rpm
检查是否安装成功

[root@centos7 src]# erl
Erlang/OTP 19 [erts-8.0.3] [source] [64-bit] [async-threads:10]…………

Eshell V8.0.3 (abort with ^G)
1>
3、下载 rabbitmq

wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-server-3.6.6-1.el7.noarch.rpm
4、安装 rabbitmq

rpm -ivh rabbitmq-server-3.6.6-1.el7.noarch.rpm

# 如果提示如下
warning: rabbitmq-server-3.6.6-1.el7.noarch.rpm: Header V4 RSA/SHA1 Signature,
key ID 6026dfca: NOKEY
error: Failed dependencies:
socat is needed by rabbitmq-server-3.6.6-1.el7.noarch

# 安装 socat
yum install socat -y
方法 二
1、配置 epel

yum install epel-release
2、安装

yum install rabbitmq-server
5、启动

# 启动
systemctl start rabbitmq-server

# 状态
systemctl status rabbitmq-server

# 关闭
systemctl stop rabbitmq-server
6、配置网页插件(从网页登陆端口号:15672)

# 启用插件
rabbitmq-plugins enable rabbitmq_management
7、配置防火墙

# 添加端口
vi /etc/sysconfig/iptables
-A INPUT -p tcp -m state –state NEW -m tcp –dport 15672 -j ACCEPT

# 重启生效
systemctl restart iptables
8、配置访问账号密码和权限

# 添加用户mq,密码mq123
rabbitmqctl add_user mq mq123

# 添加权限
rabbitmqctl set_permissions -p / mq “.*” “.*” “.*”

# 修改用户角色
rabbitmqctl set_user_tags mq administrator

# 其它操作
# 删除一个用户
rabbitmqctl delete_user Username

# 修改用户密码
rabbitmqctl change_password Username Newpassword

# 查看当前用户列表
rabbitmqctl list_users
9、登陆

http://192.168.1.72:15672

 

Flutter集成到Android Studio中遇到的各种坑(实测)

一、Android Studio not found at /Users/*/Application/Android Studio.app/Contents
问题出现的原因:(解决另一个问题(问题二.2)引起的)

1.配置完问题二.2后,我flutter doctor就出现

 

明明我的flutter插件和Dart插件都安装好了,还提示我未安装。

解决办法:运行命令:flutter config –android-studio-dir=

二、flutter项目在Android Studio中显示no devices,没法flutter run

问题环境(Mac、Android studio3.1.2) 这个问题真是坑,网上的各种办法都试了,就是不行,试过的办法有:

1、检查Android studio中的flutter项目的flutter sdk路径、Dartsdk路径、Androidsdk路径

 

 

 

上面三个路径都在我的项目设置中检查过,没问题,所以这个无法解决我的问题二。

2、在终端把flutter和Android studio绑定、在终端把flutter和Android sdk绑定。

flutter config –android-sdk 自己的android sdk路径

flutter config –android-studio-dir 自己的android studio安装路径

这里的Android studio安装路径我不知道 Mac电脑的程序安装路径到底是怎么获取(有知道的告知一下,我怀疑就是这里搞错了,才没解决问题二,并且引出了问题一),所以我在应用程序里面右键选择“显示包内容”,然后把这个里面的一个文件夹拖进去终端

 

3、最终我通过自己的方法运行项目:这个办法要先解决问题一

我在Android studio的终端Terminal运行了

flutter clean

flutter run

 

这样发现居然可以运行了,虽然点上面的运行绿色按钮还是提示no devices。但我觉得这个办法很牵强。

 

还可以配合这些命令使用flutter run。

三、FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.
> Could not resolve all task dependencies for configuration ‘:app:debugCompileClasspath’.
> Could not resolve io.flutter:flutter_embedding_debug:1.0.0-ee76268252c22f5c11e82a7b87423ca3982e51a7.

 

用了终端的flutter run运行遇到这个问题。

解决办法:在Android项目下的build.gradle增加一个仓库:maven { url “http://download.flutter.io” },增加完之后就

flutter run

这样我就在Mac运行了自己的第一个flutter项目。

 

四、…..\android\sdk\platform-tools\adb.exe is too old;please install version 1.0.39 or later

这个问题是Windows产生的,因为我电脑C盘和D盘有两个Android SDK,不知道他这里就选到了C盘下比较老的版本,既然这样,我就去settings里面设置我另一个Android SDK不就可以。结果我去一看,这明明已经是D盘下新的SDK:

 

然后就各种抓头,这是啥东西啊,搞人啊,最后没办法我把C盘下的SDK给删除了,就可以了。

五、Android studio新建Flutter项目,报错could not find an option named “platforms”(2021-08-08)
原因:Flutter SDK版本过低导致

解决:下载最新版本Flutter SDK即可

 

从flutter1.17.4升级到2.2.3;可能是我中间升级过一次Android Studio

六、Error: Cannot run with sound null safety, because the following dependenciesdon‘t support null safe
Flutter 启动运行的时候报错:

Error: Cannot run with sound null safety, because the following dependencies
don’t support null safety:

– package:banner_view

For solutions, see https://dart.dev/go/unsound-null-safety

Command PhaseScriptExecution failed with a nonzero exit code

解决方案:(这是因为flutter2.0增加了 null safety模式,很多第三方库还不支持这个模式)

可以直接在命令行中执行

flutter run –no-sound-null-safety
也可以到Android studio中去设置运行配置

首先打开Edit Configurations 页面,填上:–no-sound-null-safety

 

————————————————
版权声明:本文为CSDN博主「sunbinkang」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sunbinkang/article/details/106941458

pip install mysqlclient error

I just had the same problem and only got a partial working solution. Here are the steps I made to make it work:

  • brew install mysql-client
  • brew install mysql-connector-c

IF YOU HAVE ZSH:

  • echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.zshrc
  • source ~/.zshrc

ELSE:

  • echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
  • source ~/.bash_profile

Now for the installation itself:

  • LDFLAGS=-L< your openssl lib folder location > pip install mysqlclient==<  version  >

for exampleLDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient==1.3.12

Error loading MySQLdb Module ‘Did you install mysqlclient or MySQL-python?’

24

Faced same problem after migrating to python 3. Apparently, MySQL-python is incompatible, so as per official django docs, installed mysqlclient using pip install mysqlclient on Mac. Note that there are some OS specific issues mentioned in docs.

Quoting from docs:

Prerequisites

You may need to install the Python and MySQL development headers and libraries like so:

sudo apt-get install python-dev default-libmysqlclient-dev # Debian / Ubuntu

sudo yum install python-devel mysql-devel # Red Hat / CentOS

brew install mysql-connector-c # macOS (Homebrew) (Currently, it has bug. See below)

On Windows, there are binary wheels you can install without MySQLConnector/C or MSVC.

Note on Python 3 : if you are using python3 then you need to install python3-dev using the following command :

sudo apt-get install python3-dev # debian / Ubuntu

sudo yum install python3-devel # Red Hat / CentOS

Note about bug of MySQL Connector/C on macOS

See also: https://bugs.mysql.com/bug.php?id=86971

Versions of MySQL Connector/C may have incorrect default configuration options that cause compilation errors when mysqlclient-python is installed. (As of November 2017, this is known to be true for homebrew’s mysql-connector-c and official package)

 

Flutter引用第三方库时Automatically assigning platform `ios` with version `8.0` on target `Runner`错误解决

Automatically assigning platform ios with version 8.0 on target Runner because no platform was specified. Please specify a platform for this target in your Podfile

在mac上使用引用了第三方库,发现报错,解决步骤如下:

解决办法:

1.platform version错误,解决方法是修改项目里的ios/Podfile文件:

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '8.0' #增加的内容

之后又遇到如下问题

2.SWIFT_VERSION版本未指定问题,解决方法是修改项目里的ios/Podfile文件:

flutter Unable to determine Swift version for the following pods

是指定的SWIFT版本问题,但xcode的tagets中没有指定SWIFT_VERSION版本这一项,点buildSettings中的+号,添加SWIFT_VERSION,指定版本号4.2,再执行pod update –verbose –no-repo-update解决问题

修改项目里的ios/Podfile文件:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '4.2'  #增加修改内容
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

3.flutter ‘xxxxx/xxxx-Swift.h’ file not found问题:修改项目里的ios/Podfile文件

之后又遇到如下问题

flutter ‘xxxxx/xxxx-Swift.h’ file not found

修改项目里的ios/Podfile文件:

target 'Runner' do
  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  use_frameworks! # required by qr_code_tools #增加修改的内容
  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')

4.PrerollContext does not support embedding错误问题,解决方法是添加plist选项:

Trying to embed a platform view but the PrerollContext does not support embedding

解决方法:
Currently apps need to opt-in for the UIViews embedding preview on iOS by adding a boolean property to the Info.plist (key=io.flutter.embedded_views_preview value=YES).

在iOS工程的info.plist文件中添加键值对key=io.flutter.embedded_views_preview value=YES