Tag Archives: Python

This application failed to start because not Qt platform plugin could be initialized.

The following error appears when pyside2 is running:
error content: this application failed to start because not Qt platform plugin could be initialized.reinstalling the application may fix this problem.

Solution one: this method once and for all.

Add the plugins/platforms in the path of pyside2 to the user variables in the system environment variables. My path is as follows:
the specific operation is as follows:


variable name: QT_ QPA_ PLATFORM_ PLUGIN_ Path
variable value: D:: (soft) Anaconda (LIB) site packages (pyside2) plugins (platforms)
different users have the same variable name, and the variable value varies with the file location
finally, after saving the variables, be sure to restart the computer, because the new environment variables will not be recognized by the system until they are restarted!

**

Solution 2:

**
add the following code in the initial part of the program:

dirname = os.path.dirname(PySide2.__file__)
plugin_path = os.path.join(dirname, 'plugins', 'platforms')
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path

Code means to use temporary system environment variables, similar to solution one.

Error in Python data fetching “[SSL: Certificate]_ VERIFY_ FAILED] certificate verify failed (_ The solution of “None” problem in SSL. C: 841

 

Python:Python 3.6.6(Python Downloads)

Refer to the online solution, is the problem caused by the self signed certificate. The simple solution is to cancel the certificate verification, that is, to add:

ssl._create_default_https_context = ssl._create_unverified_context

How to Solve Error: [Errno 11001] getaddrinfo failed

When starting Django project, we encountered: error: [errno 11001] getaddrinfo failed error

You can run the following command in Ubuntu, but if you transfer the project to windows 10, there will be an error:

# --insecure argument to force django to process static files, when closing debug is added (--insecute)
python manage.py  runserver 0:8000 --insecure
# or
python manage.py  runserver 0:8000

Debug code in settings.py file

DEBUG = False
ALLOWED_HOSTS = ["*"]

Run the following command in Windows 10 to solve the problem

python manage.py runserver 0.0.0.0:8000 --insecute
# or
python manage.py runserver 0.0.0.0:8000

After tensorflow is installed, an error occurred during import: importerror: DLL load failed: the specified module cannot be found

(author: Chen Yao)
share a friend’s AI tutorial. Zero base! Easy to understand! Funny! And yellow jokes! You can see if it helps you http://www.captainbed.net/luanpeng

Tensorflow can be installed through pip or anaconda, but after installation, it can be run in Python script

import tensorflow as tf

Error: importerror: DLL load failed: unable to find the specified module.

Three solutions are tried

1) In addition to tensorflow, we need to install tensorflow GPU

Later I learned that the installation of tensorflow GPU is mainly for acceleration, and this problem has not been solved after the installation.

2) Second, unloading and reloading

Therefore, we upgraded pip, uninstalled it through PIP install tensorflow and then re installed it through PIP install tensorflow , which still can't solve the problem.

3) Third, we need to update pilot

Pilot is an image processing library in Python, which comes with anaconda. But maybe because of the older version of pilot, it needs to be updated.

conda uninstall pillow
conda update pip
pip install pillow

Through the above three lines of commands, first uninstall the pilot in anaconda, then update the PIP, and then install the latest pilot through the upgraded pip. The problem is solved. Hehe, it's also amazing. I don't know why the python package conflicts with tensorflow.... However, when installing, most of the strange problems are version problems. You can only check the version more, but most of the time it's upgrade, sometimes it's a headache to downgrade.

reference material:

https://blog.csdn.net/blueheart20/article/details/79612985

Solving the problem of “solving environment: failed” of CONDA

1. Problem code

Recently, when CONDA installed the software package, the following problems appeared all the time. I found many solutions on the Internet, but they didn’t solve my problem. See link

Collecting package metadata (current_repodata.json): done
Solving environment: failed with current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed
Initial quick solve with frozen env failed.  Unfreezing env and trying again.
Solving environment: failed

2. Find out the reason

Later, when looking at the error message, I found that it was to use two commands of CONDA forge that caused this error. The culprit is the second sentence.

conda config --add channels conda-forge
conda config --set channel_priority strict

3. Solutions

conda config --set channel_priority flexible

 

Python pandas.read_ Oserror: initializing from file failed

Python version: Python 3.6
version pandas.read_ Oserror: initializing from file failed is usually caused by two cases: one is that the function parameter is path instead of file name, the other is that the function parameter is in Chinese.

# -*- coding: utf-8 -*-
"""
Created on Mon Jun  4 09:44:36 2018
@author: wfxu
"""
import pandas as pd
da1=pd.read_csv('F:\\datas')
da2=pd.read_csv('F:\\2.0 datas\\lists.csv')

In both cases, the error message is the same:

Traceback (most recent call last):
	(Error reporting details are not shown)
  File "pandas/_libs/parsers.pyx", line 720, in pandas._libs.parsers.TextReader._setup_parser_source

OSError: Initializing from file failed

For the first case, it’s very simple. The reason is that you don’t put the file name after the path. Just add the file name after the path. You can also switch the folder to the folder where the target file is located in the code. The process is too complicated, I don’t like it or recommend it, so I won’t show it
in the second case, even if the path and file name are complete, an error is still reported because there is Chinese in this parameter, but doesn’t Python 3 already support Chinese?Referring to the cause of the error and the source code of panda, it is found that the read of panda is called_ When using the CSV () method, C engine is used as the parser engine by default. When the file name contains Chinese, using C engine will make mistakes in some cases. So I’m calling read_ The problem can be solved by specifying engine as Python when using the CSV () method.

da4=pd.read_csv('F:\\datas\\lists.csv',engine='python')

For the second case, another solution is to use the open function to open the file, and then access the data in it

da3=pd.read_csv(open('F:\\4.0 \\2.0 datas\\02.lists.csv'))

Well, the reasons for this error are understood, and the solution is very simple and crude, isn’t it very simple!

This application failed to start because no Qt platform plugin could be initialized

I also encountered this error when I started after installing the Mumu simulator. Today, I also encountered this problem when debugging the pycarm breakpoint. When I ran to the breakpoint, this error box would pop up:

(at this time, I had a hunch that this was a very big problem (FOG))
neither Baidu nor Google solved my problem, I did it again through pip, but it didn’t work. Later, I solved this problem by deleting environment variables directly

this is Qt5 automatically installed in anconda. It should be the wrong version. Maybe the one installed with PIP later was right, but the one in the environment variable was not right. After deleting it directly, I didn’t add any additional environment variables, so the problem was solved directly

Conda Install Library Error: failed with initial frozen solve. Retrying with flexible solve.

Error in CONDA installation Library:

conda install keras
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.

Solution:

conda config --set channel_priority flexible

Then it’s running normally

conda install keras
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: E:\Apps\Anaconda3

  added/updated specs:
    - keras


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    tensorflow-base-1.15.0     |mkl_py37h190a33d_0        36.2 MB
    ------------------------------------------------------------
                                           Total:        36.2 MB

The following NEW packages will be INSTALLED:

  keras              pkgs/main/win-64::keras-2.2.4-0
  keras-base         pkgs/main/win-64::keras-base-2.2.4-py37_0

The following packages will be DOWNGRADED:

  tensorflow                       2.0.0-mkl_py37he1bbcac_0 --> 1.15.0-mkl_py37h3789bd0_0
  tensorflow-base                  2.0.0-mkl_py37hd1d5974_0 --> 1.15.0-mkl_py37h190a33d_0
  tensorflow-estima~                     2.0.0-pyh2649769_0 --> 1.15.1-pyh2649769_0


Proceed ([y]/n)?y


After looking at the installation process, it seems that keras is based on tensorflow 1.5…

Then I gave up keras, refactored the code, and used the tensorflow.keras Instead of keras. Most of keras are in tensorflow.keras Have, some can’t directly correspond to their own online search on the line.