Solution: convert the index strength of the array to int
Example:
# original
length = [id2tags[i.item()] for i in y[0].cpu() if i.item() > 0]
# Modify to:
length = [id2tags[int(i.item())] for i in y[0].cpu() if i.item() > 0]
Solution: convert the index strength of the array to int
Example:
# original
length = [id2tags[i.item()] for i in y[0].cpu() if i.item() > 0]
# Modify to:
length = [id2tags[int(i.item())] for i in y[0].cpu() if i.item() > 0]
#Read a *.txt file using the read_table() function in the Pandas library
data = pd.read_table(r'D:\New\test.txt',delimiter=',',encoding = 'UTF-8')
print(data)
Title defect Solution: add “R” before the path to solve it.
python D:\New\MyTest.py
name date id
0 jianghu 20210201 00001
1 jianghu1 20210202 00002
2 jianghu2 20210203 00003
MAC system + anaconda3 + Python 3 eight point eight
The two integrated learning algorithm packages lightgbm and xgboost were successfully installed
, but errors were always reported during import
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-5-b18b3f8a6dc8> in <module>
----> 1 import lightgbm
dlopen(/Users/kumahiroshi/opt/anaconda3/lib/python3.8/site-packages/lightgbm/lib_lightgbm.so, 6): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib
Referenced from: /Users/kumahiroshi/opt/anaconda3/lib/python3.8/site-packages/lightgbm/lib_lightgbm.so
Reason: image not found
Always report: oserror reason: image not found
After consulting the data, it is found that you only need to re import this line of code after running on the terminal: brew install libomp
brew install libomp
Done!
Need to install: Homebrew,
Install commands:ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
1、 Exception 1: runtimeerror: an attempt has been made to start a new process
Reason: multiple processes need to run in the main function
Solution 1:
Add the main function and call it in main.
if __name__ == '__main__':
main()
Solution 2:
num_workers changed to 0, single process loading
Ers changed to 0, single process loading
The parameter may be missing or the property may be changed as follows:
parser.add_argument('--model', default='ResNet18',required=True)
args = parser.parse_args()
Replace with:
parser.add_argument('--model', default='ResNet18')
args = parser.parse_args()
Follow the instructions in my last blog to install spacey:
install spacey
install from offline package:
pip install en_core_web_trf-3.1.0.tar.gz
But an error is reported:
the solution is very simple. Put Python 3 Replace 6.0 with any other Python version. The error is 3.6 0 so unique:
ERROR: Cannot uninstall ‘PyYAML’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Problem Description.
When installing transformers, an error is reported: “ERROR: Cannot uninstall ‘PyYAML’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.”
pip install transformers
Solution:
You only need to modify the original installation command to:
pip install transformers --ignore-installed PyYAML
Just.
Similar problems can be solved in this way.
1. Problem Description: prepare to execute the following command in Anaconda prompt:
conda install -c stellargraph stellargraph
An HTTP error occurred when trying to retrieve this URL
HTTP errors are often intermittent, and a simple retry will get you on your way.
2. Solution: open “C:\users\your computer name\condarc
Delete all lines in condarc, copy and paste the following code, and then save:
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
show_channel_urls: true
ssl_verify: true
(anyway, I can finally succeed in this file with the above code. I don’t know if you can do it.
3. Re run
conda install -c stellargraph stellargraph
Create a new environment ( CONDA env create - n env_name
) and install the software. In this way, the compatibility with the existing software will not be considered. It can also greatly reduce the search space and improve the speed of resolving software dependencies.
ERROR: Cannot uninstall ‘wrapt’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Problem Description.
When installing tensorflow, an error is reported: “ERROR: Cannot uninstall ‘wrapt’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.”
pip install tensorflow==1.15.0
Solution:
Change the command to:
pip install tensorflow==1.15.0 --ignore-installed wrapt
Run Django with pycharm, python manage Py runserver error
Checked the Internet and said to put widgets Delete the comma in line 152 of Py, which may be a compatibility problem between Python and Django. Try it. You can click the hyperlink above. Pycharm can quickly open the document, and then find the widgets under admin Py file is OK, because the prompt says form Django contrib. Admin import helpers, widgets, and options The PY file is in the admin directory.
When compiling Python today, I encountered an error in the code. Check the data to understand that the following code should be missing.
The error interface is shown in the figure below:
You can solve this problem by adding the following code to the python file (as shown below).
#!usr/bin/python
# -*- coding: utf-8 -*-