Tag Archives: python

ValueError: check_ hostname requires server_ The solution record of the host name

Error: valueerror: check when installing scikit image library with PIP_ hostname requires server_ hostname

Valueerror: check_ hostname requires server_ Hostname is usually due to version conflict and other reasons. After looking up the experience of many big men on the Internet, we finally find that the problem is caused by the network agent, which is commonly known as the VPN problem.

After the VPN is turned off, the problem is solved, and the scikit image library is successfully installed!

Collection and solution of error reporting on various platforms of pyspider

Collection and solution of error reporting in pyspider

Command “python setup.py egg_ info” failed with error code 10

This means that pycurl installation reported an error

Download address of WHL file of pycurl in win10 solution

# Follow the link above to download the pycurl whl file, pay attention to your own python version, I'm using python 3.7 here
# locate the path to change the file
pip3 install pycurl-7.43.0.4-cp37-cp37m-win_amd64.whl

CentOS solution

yum install python-devel curl-devel
pip3 install pycurl

Ubuntu solution

sudo apt-get install libcurl4-gnutls-dev
pip install pyspider

SyntaxError: invalid syntax

Async cannot be used as a keyword and needs to be changed as a variable

Run pyspider to find the error file and replace async to know that the error was not reported

ImportError: cannot import name ‘Disp

[How to Solve] Kernel died with exit code 1.

  When jupyter is installed on the vscode and a sentence of Python code is calculated randomly in the ipynb file, the error of kernel died with exit code 1, C:: (users, hpccp, appdata, roaming, python, python38, site packages, traitlets) appears. I’ve been looking for solutions on the Internet all the time. I’ve spent a lot of energy trying many solutions, but I can’t, Because the error of kernel died with exit code 1 may be caused by many different details, and the root cause of the error is different. Of course, other people’s solutions may not be applicable to themselves.

So I began to pay attention to the details of my error. I wonder if there is something wrong with this folder, because my vscode and juptyer plug-ins have just been re installed (I have repeatedly uninstalled and re installed several times, but the first two have not been completely uninstalled), C: The folder was created before. I deleted the folder and its contents. Then the problem was solved.

For the problem of rejecting old usage errors after numpy is updated, modified in numpy 1.20; for more details and guidance

There’s something wrong with numpy

Because the latest version of numpy is updated today, the previous usage is invalid

So You need to use the latest usage

Originally, my return value is like this

return np.array(df).astype(np.float)

Error:

DeprecationWarning: np.float is a deprecated alias for the builtin
float. To silence this warning, use float by itself. Doing this
will not modify any behavior and is safe. If you specifically wanted
the numpy scalar type, use np.float64 here.

Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
return np.array(df).astype(np.float)

It seems to be because of the version of the problem

If you look at the picture
Modify to the following can be.

return np.array(df, dtype=float)

perhaps

return np.array(df).astype(np.float64)

So you won’t make a mistake

The python version output from the command line is inconsistent with the python version in the current CONDA environment

Record a strange little problem.

         In order to complete the emotional dialogue project arranged by my tutor, I found a model from GitHub, and then configured the environment python2.7 + tensorflow1.13.1 on the server according to readme. At the beginning of training, I found that the training speed was very slow. After checking, I found that I didn’t use the GPU version of tensorflow, so I changed it to tensorflow-gpu1.13.1.

         Import error: libcublas. So. 10.0: cannot open shared object file: no such file or directory

         Very common old problem, CUDA is not installed or environment variables are not configured. I didn’t add CUDA to the environment variable here, because it’s a server in the school laboratory. It doesn’t have sudo permission and can’t modify the environment variable of the system, so I can only add the environment variable I need with the export command every time I start the terminal. For convenience, all the environment variables that need to be exported are recorded in a file. You only need the file source each time.

        After the source is completed, a strange problem appears. I output Python 3.8.5 with Python command in CONDA environment, and the python version of the environment shown in CONDA list is 2.7, as shown in the figure below. Clearly is the environment of Python 2.7, why use the python command to prompt that the current version is Python 3.8.5?I try to import tensorflow. It also prompts no module named tensorflow, which means that although it shows that I am in the dual RL master environment, I am in another environment?

         I repeatedly tried to delete the environment, create a new environment, and re install various packages. After many tests, I finally found the problem. When CONDA activate is executed, the target environment will be added to the environment variable of the current system, so when the python command is executed on the command line, the python version in the target environment will be executed. When the export command is executed, the specified environment variable will be added to the system environment variable. When the variable name is repeated, the existing environment variable will be overridden. When I use source to execute files containing many export commands, one of the export commands adds the default Python version of CONDA to the environment variables of the system, which covers the python version I activated with CONDA before. Therefore, although my CONDA shows that the python version I used is 2.7, the environment variables of the system have been covered by the export command I used later, The default version of Python is 3.8.5.

        I tested again. First add a python version to the environment variable by using export, and then use CONDA activate to activate another version of Python. Using Python on the command line, you will find that the output is the later version of Python. Therefore, you can conclude that the one added after the same variable name in the environment variable will override the existing one.

         Although it’s not a big problem, sometimes it’s this kind of energy-saving twig that keeps you from finding mistakes.

Problems encountered in the installation of pyromacoustics

Twists and turns

Contents of articles

Error 1 error 2 error 3 error 4 reference source link

When installing pyromacoustics, there is only one sentence:

pip install pyroomacoustics

Error 1

My Anaconda navigation interface couldn’t work. I kept reporting errors. I downloaded Anaconda again, but it still couldn’t work. Later, I gave up the latest version of anaconda and used the old version of Anaconda directly. Tsinghua image link:
here is an example https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
I can download 2020.11
there is a problem with the previously downloaded version of 2021.05.

Error 2

I forgot to report a mistake. Anyway, you need to install the dependency package. You need to install the following first.

conda install matplotlib cython scipy

You can use the following command:

conda init

Then close command pompt and turn it back on.

Error 3

ValueError: check_ hostname requires server_ Hostname
to see if your computer uses a network agent, just turn off the agent I don’t know why. Anyway, it’s right to install with Tsinghua image. As follows:

pip --default-timeout=100 install pyroomacoustics -i https://pypi.tuna.tsinghua.edu.cn/simple

coming

https://blog.csdn.net/sinat_26811377/article/details/106144379

[Solved] Interface automation test: JSON parse error

1.error:
{
“title” : “Bad Request”,
“status” : 400,
“detail” : “JSON parse error: Unrecognized token ‘username’: was expecting (‘true’, ‘false’ or ‘null’); nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token ‘username’: was expecting (‘true’, ‘false’ or ‘null’)\n at [Source: (PushbackInputStream); line: 1, column: 10]”,
“path” : “/getToken”,
“message” : “error.http.400”
}
2.codes

import requests


url = 'http://10.165.153.210/getToken'
headers = {
    'Content-Type': 'application/json'
}
payload = {
    'username': 'pad_view',
    'password': '6368da1213cd4c4538128a0e9acd0288'
}
res = requests.post(url=url,method='post', data=payload, headers=headers)
print(res.text)

3. Reasons

When you request to pass parameters, the JSON string and dictionary look the same, but the background serialization format is different. Therefore, a JSON parsing error will be reported when data is passed in

4. Solutions

Convert dictionary object to JSON string

4.1 import JSON

import json

4.2 convert dictionary object to JSON string

payload = json.dumps({
    'username': 'username',
    'password': 'password'
})

4.3 complete modification code, as follows

import requests
import json  # import json


url = 'http://10.165.153.210/getToken'
headers = {
    'Content-Type': 'application/json'
}
# Convert a dictionary object into a json string, using the json.dumps() method
payload = json.dumps({
    'username': 'pad_view',
    'password': '6368da1213cd4c4538128a0e9acd0288'
})
res = requests.post(url=url,method='post', data=payload, headers=headers)
# Print the response message
print(res.text)

RuntimeError: implement_array_function method already has a docstring(Pycharm install package error)

Recently, I’m writing the course of financial analysis and prediction in Python. Because I’m lazy, I didn’t match the required Library under CONDA in advance. Using pychar install package directly will lead to some version incompatibility and mismatching due to the installation sequence, which leads to
runtimeerror: implementation_ array_ Function method already has a docstring
error report
mark
I don’t know what I’m writing<
PIP universal pandas
PIP universal mattlotlib
PIP universal Skippy
PIP universal numpy
PIP universal scikit learn
then install
PIP install numpy
PIP install Skippy
PIP install panda
PIP install mattlotlib
pip install scikit learn
in the following order

Unicode encodeerror encountered in Python 3

Run a business script locally today, perfect!

Then deploy the script to the server to run, perfect!

Add to crontab timing task, report error!

UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 57-60: ordinal not in range(128)

Then all kinds of methods are checked, according to the blogger’s method can not solve
after a toss, there’s no choice but to use a stupid method. Add the running script to a shell script and add the following two lines of code in front of it. It’s normal! It’s a solution anyway

export LANG="en_US.UTF-8"
export PYTHONIOENCODING=utf-8