Category Archives: Linux

[Solved] Linux installation pillow error: ValueError: jpeg is required unless explicitly disabled using –disable-jpeg, aborting

linux installation pillow error:

ValueError: jpeg is required unless explicitly disabled using –disable-jpeg, aborting

After searching, I found the following two solutions:

One:

sudo yum install python-devel
sudo yum install zlib-devel
sudo yum install libjpeg-turbo-devel

two:

sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk

The first one I use, the following one may not support the linux version I use, just keep it as a spare. After execution, run pip install pillow again.

 

Official website solution: https://pillow.readthedocs.io/en/3.0.0/installation.html#linux-installation

Linux Installation

Note

Most major Linux distributions, including Fedora, Debian/Ubuntu and ArchLinux include Pillow in packages that previously contained PIL e.g. python-imaging. Please consider using native operating system packages first to avoid installation problems and/or missing library support later.

We do not provide binaries for Linux. If you didn’t build Python from source, make sure you have Python’s development libraries installed. In Debian or Ubuntu:

$ sudo apt-get install python-dev python-setuptools

Or for Python 3:

$ sudo apt-get install python3-dev python3-setuptools

In Fedora, the command is:

$ sudo yum install python-devel

Prerequisites are installed on Ubuntu 12.04 LTS or Raspian Wheezy 7.0 with:

$ sudo apt-get install libtiff4-dev libjpeg8-dev zlib1g-dev \
    libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk

Prerequisites are installed on Ubuntu 14.04 LTS with:

$ sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev \
    libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk

Prerequisites are installed on Fedora 20 with:

$ sudo yum install libtiff-devel libjpeg-devel libzip-devel freetype-devel \
    lcms2-devel libwebp-devel tcl-devel tk-devel


ValueError:–enable-zlib requested but zlib not found, aborting.

Run pip install pillow==3.1.1 under Ubuntu 14.04 and report an error, ValueError: –enable-zlib requested but zlib not found, aborting.

$ sudo apt-get build-dep python-imaging

$ sudo apt-get install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev

$ pip install Pillow==3.1.1

Nginx error: nginx: [error] invalid PID number ““ in “/run/nginx.pid“

Error: after modifying the configuration file, reload it, and then report an error. nginx: [error] invalid PID number “” in “/usr/local/var/run/nginx.pid”

Solution restart nginx

nginx -c /usr/local/etc/nginx/nginx.conf
nginx -s reload

View port occupancy

lsof -i:8080

Delete port 8080 process

kill -9:834

To install nginx on MAC, use nginx - V to view the installation path

configure arguments: --prefix=/usr/local/Cellar/nginx/1.19.6 --sbin-path=/usr/local/Cellar/nginx/1.19.6/bin/nginx    --conf-path=/usr/local/etc/nginx/nginx.conf

-- prefix =/usr/local/cellular/nginx/1.19.6 represents the installation path -- SBIN path represents the executable path -- conf path represents the configuration file path

How to Solve Linux error – rsyncd synchronous error 1


Linux error reporting-rsyncd sync error 1
Problem Description.
[root@pxapp1 webapps]# rsync -avz –delete /opt/tomcat/webapps/ [email protected]:tomcat-webapps
sending incremental file list
rsync: read error: Connection reset by peer (104)
rsync error: error in socket IO (code 10) at io.c(785) [sender=3.1.2]

Problem Cause.
Configuration problem

Solution.
The client needs to configure read only = no
Restart rsyncd: systemctl restart rsyncd

[Solved] Error report of introducing Vue into ecarts GL

ERROR Failed to compile with 3 errors 11:11:19 ├F10: AM┤
This dependency was not found:
echarts/lib/label/labelStyle in ./node_modules/echarts-gl/lib/component/common/LabelsBuilder.js, ./node_modules/echarts-gl/lib/component/grid3D/Grid3DView.js and 1 other
To install it, you can run: npm install –save echarts/lib/label/labelStyle
This error was reported after the introduction was started
then downgraded
npm install [email protected] --save

[Solved] Shell error: syntax error: unexpected end of file

Sometimes an error will be reported when executing the script:

[root@host1 shell]# sh -x test. sh  
+ $ ' \r '
: command not found
test. sh : line 37 : syntax error: unexpected end of file

reasons may be:

The text editor is the file written by Notepad or other editors under windows, and it runs in the cygwin simulation LINUX software environment.

Solutions:

The file format difference between DOS and Linux is caused.

The text file under DOS uses \r\n as the line break mark, expressed in hexadecimal is 0D 0A. The text file under Unix uses \n as a line break mark, which is 0A in hexadecimal.

[In windows, the two symbols used for line feed, carriage return \r, line feed symbol \n, under linux, only one symbol \n is enough .]

A text file in DOS format under Linux will display ^M at the end of the line when opened with a lower version of vi. Of course, you may not be able to see it, but in vi, the format of the file will be displayed below, “M.txt “[dos] 8L, 72C means a dos file format.

solution:

Use the following command to set the file format to unix format to solve the above error

vi test. sh 
:set fileformat = unix
:wq

Why can’t the script edited under windows be directly copied to the unix system and run directly?

Linux executes SHELL script error “syntax error near unexpected token `in”

long long ago….. Old teletypewriters used two characters to start a new line. One character moves the carriage back to the first position (called carriage return, <CR>, ASCII code 0D), and another character moves the paper up one line (called line feed, <LF>, ASCII code 0A). When computers came out, memory used to be very expensive. Some people think it is unnecessary to use two characters to indicate the end of a line. Unix developers decided that they could use a character to indicate the end of a line, Linux followed Unix, and it was also <LF>. Apple developers specified the use of <CR>. The guys who developed MS-DOS and Windows decided to use the old <CR><LF>.

Because MS-DOS and Windows use carriage return + line feed to represent line feed, so under Linux, use Vim to view the code written in VC under Windows. The “^M” symbol at the end of the line indicates a symbol.

Solve git upload file error [rejected] master -> master (fetch first) error: failed to push some refs to ‘

When push is executed, an error will be reported. The error code is as follows:

$ git push -u origin master
To gitee.com:backspacegit/aafdajs.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'gitee.com:backspacegit/aafdajs.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

This problem occurs because the readme.md file in GitHub is not in the local code directory. You can merge the code with the following command

git pull --rebase origin master

Then execute the statement

git push -u origin master

Done!

CentOS 7 composer install error: phpunit/phpunit 4.8.35 requires ext-dom *

Problem:
[root@localhost laravel_demo]# composer install Loading composer repositories with package information

Installing dependencies (including require-dev) from lock file

Your requirements could not be resolved to an installable set of packages.

Problem 1

– phpunit/phpunit 4.8.35 requires ext-dom * -> the requested PHP extension dom is missing from your system.

– phpunit/phpunit 4.8.35 requires ext-dom * -> the requested PHP extension dom is missing from your system.

– Installation request for phpunit/phpunit 4.8.35 -> satisfiable by phpunit/phpunit[4.8.35].

To enable extensions, verify that they are enabled in your .ini files:

– /etc/php.ini

– /etc/php.d/bz2.ini

– /etc/php.d/calendar.ini

– /etc/php.d/ctype.ini

– /etc/php.d/curl.ini

– /etc/php.d/exif.ini

– /etc/php.d/fileinfo.ini

– /etc/php.d/ftp.ini

– /etc/php.d/gd.ini

– /etc/php.d/gettext.ini

– /etc/php.d/gmp.ini

– /etc/php.d/iconv.ini

– /etc/php.d/json.ini

– /etc/php.d/ldap.ini

– /etc/php.d/mbstring.ini

– /etc/php.d/mcrypt.ini

– /etc/php.d/mysqli.ini

– /etc/php.d/pdo.ini

– /etc/php.d/pdo_mysql.ini

– /etc/php.d/pdo_sqlite.ini

– /etc/php.d/phar.ini

– /etc/php.d/shmop.ini

– /etc/php.d/simplexml.ini

– /etc/php.d/sockets.ini

– /etc/php.d/sqlite3.ini

– /etc/php.d/tokenizer.ini

– /etc/php.d/xml.ini

– /etc/php.d/zip.ini

You can also run `php –ini` inside terminal to see which files are used by PHP in CLI mode.

Solution:
[root@localhost ~]# yum search php70w    Check the packages available for installation
[root@localhost ~]# yum -y install php70w-xml.x86_64
[root@localhost ~]# systemctl restart httpd.service restart apache
Test:
[root@localhost ~]# systemctl restart httpd.service
[root@localhost ~]# cd /home/www/laravel_demo/
[root@localhost laravel_demo]# composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 0 installs, 2 updates, 0 removals
– Updating symfony/event-dispatcher (v3.2.4 => v3.2.3): Downloading (100%)
– Updating symfony/yaml (v3.2.4 => v3.2.3): Downloading (100%)
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
Generating optimized class loader

Solved: could not find the task ‘G + + build active file, leetcode algorithm ACM compilation and debugging

Project scenario:

Environment: Ubuntu 20.04

Tool: vscode

Because leetcode can’t debug the code (for members), it’s necessary to configure the local environment to run the code.

Leetcode’s code is to help you configure all the environments. You only need to write the core code, but you need to write all the code yourself during the interview. It’s ACM mode (Baidu ACM). At this time, if you don’t often write all the code, it’s easy to be confused (this is what happened when I was deeply convinced in the online interview)

So it’s necessary to configure the local environment and write the whole process of algorithm implementation, including the compilation process and principle of cpp file, and the debug process can make you more familiar with the code running process.

Reference for compiling environment configuration: https://code.visualstudio.com/docs/cpp/config-linux

No Baidu, no Baidu! Look at the official statement is always the best!!! If you don’t understand English, you can right-click to translate the web page directly.

My task.json configuration: it is automatically generated. The configuration of the computer and the environment is different, so this file may be different.

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cppbuild",
			"label": "C/C++: g++ Generate activity files",
			"command": "/usr/bin/g++",
			"args": ["-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}"],
			"options": {
				"cwd": "${fileDirname}"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": {
				"kind": "build",
				"isDefault": true
			},
			"detail": "Compilers: /usr/bin/g++"
		}
	]
}

My launch.json:

{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "g++ build and debug active file",
        "type": "cppdbg",
        "request": "launch",
        "program": "${fileDirname}/${fileBasenameNoExtension}",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "setupCommands": [
          {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
          }
        ],
        "preLaunchTask": "g++ build active file",
        "miDebuggerPath": "/usr/bin/gdb"
      }
    ]
  }

Problem Description.
I encountered the following situation when configuring task.json for compiling C++ and debugging configuration file launch.json.


Cause Analysis.
Code encountered problems suggest direct google …
Reference: https://stackoverflow.com/questions/59106732/visual-studio-code-debugger-error-could-not-find-the-task-gcc-build-active-f

In your task.json file, no task is labeled as ‘gcc build active file’ which is required as a preLaunchTask in launch.json file.

So you can either change the label of task or change the content of preLaunchTask to make them match.

The answer is clear: task.json file this configuration

"label": "C/C++: g++ Generate activity files",

This configuration must be the same as launch. JSON

"preLaunchTask": "g++ build active file",

Solution:

Configure task.json as follows:

"label": "C/C++: g++ Generate activity files",

To be amended as follows:

"label": "g++ build active file",

—————————The following can be ignored———————————-

As long as the two values are the same. You can be like this: (yes, that’s what I changed it to.)

"label": "g++ build active file  hahaha",

Ubuntu: rabbitmq reports an error; Solution error: unable to connect to node rabbit@localhost : nodedown

When installing rabbitmq and executing rabbitmqctl status, the errors are as follows:

the first thing is to check the log file and form a good habit here’s my list:

root@jin:/# cd /var/log/rabbitmq/
root@jin:/var/log/rabbitmq# ls
[email protected]  [email protected]  startup_err  startup_log
# Afterwards, execute the view
cat [email protected]

As shown in the figure:

my reason is that port 5672 is occupied by other applications, so rabbitmq can’t be used. Just modify the port

[Solved] Ubuntu pyinstaller Error when packaging executable file: … qt.qpa.plugin: Could not find the Qt platform plugin “xcb“ in “…

Ubuntu pyinstaller Error when packaging the executable: … qt.qpa.plugin: Could not find the Qt platform plugin “xcb” in “…
Solution to the problem


Problem
Ubuntu pyinstaller reports an error when packaging the executable: .QFactoryLoader::QFactoryLoader() checking directory path “/home/dyj/CarUI/dist/carmain/platforms” … qt.qpa.plugin: Could not find the Qt platform plugin “xcb” in “” This application failed to start because no Qt platform plugin could be initialized.
Solution
Add the following code to your own main program code.

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