Tag Archives: Mac

Mac installation NPM install – G @Vue/cli error [How to Solve]

An error is reported when installing NPM install – G @Vue/cli on the Mac. The version is too high. Please solve with the follow code:

sudo chown -R $(whoami) /usr/local/*

Error reason: insufficient permissions

Solution:

Open the terminal and enter sudo - s

Enter your password

Create a folder to hold items. Use the CD command to switch to the directory location

Unzip the password protected zip file on the Mac with the unzip command, and the error unsupported compression method 99 is reported

    Problem: when unzip is used to unzip the password protected zip file on the Mac, the error unsupported compression method 99

    Solution: Mac’s own decompression tool cannot decrypt encrypted files. Do not install a 7zip software,

    On Ubuntu, apt install p7zip

    Brew install p7zip on MAC

    Then use the command 7z x file.zip

[Python] MAC uses the picture recognition pytesseract method to report an error

1、 Premise:

Pyteseract image recognition is used in Python, and an error is reported:

pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it’s not in your path

2、 Solution

Cause of problem:

Installed pytesseract using pip, but forgot to install the Tesseract binary.

First, go to the pytesseract.py file and find it

tesseract_cmd

Change the path

 

 

Amend to read:

 

 

 

[transfer]

1. Installation command on Linux

sudo apt update
sudo apt install tesseract-ocr
sudo apt install libtesseract-dev

2. MAC installation command

brew install tesseract

3. Installation command on Windows

from https://github.com/UB-Mannheim/tesseract/wiki Download binaries. Then add pytesseract.pytesseract.tesseract_ CMD = 'C: \ \ program files (x86) \ \ Tesseract OCR \ \ Tesseract. Exe' into the script. (if necessary, replace the path of the Tesseract binary file)

 

 

Article reference:

Thanks for Levi’s article: how to use pytesseractnotfounderror (Tesseract OCR) in Python

Super detail: command not found: the scratch solution (add the scratch environment variable to Zsh under MAC)

Background: originally, I planned to create a crawler project with scratch, but it showed Zsh: command not found: scratch . After reading many blogs, I solved the problem and decided to record it.

Main reference Blogs:

    https://www.jianshu.com/p/51196153f804

    https://stackoverflow.com/questions/17607944/scrapy-not-installed-correctly-on-mac

Problem analysis:

When I reinstall the script, I show:

WARNING: The script scrapy is installed in 
'/Library/Frameworks/Python.framework/Versions/3.9/bin' which is not on PATH.
  Consider adding this directory to PATH 
  or, if you prefer to suppress this warning, use --no-warn-script-location.

Note /library/frameworks/python.framework/versions/3.9/bin is not in the path. We need to add this path to the environment variable (consumer adding this directory to path).

terms of settlement:

Step 1: add source ~ /. Bash at the end of the. Zshrc file_ profile

    Open the finder, press Command + Shift + G, enter. Zshrc, open the. Zshrc file, and then write source ~ /. Bash at the end of the file_ profile

    Press Command + s to save

    Open the terminal, enter source ~ /. Zshrc , and execute the file.

Step 2: in. Bash_ Add environment variables to the profile file

    Open the finder, press Command + Shift + G at the same time, and enter. Bash_ Profile, open. Bash_ Profile file.

    Write on the last line:

    export PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:$PATH"

    be careful ⚠️: The number after versions is the python version number. It should be modified according to your own Python version. If the version is 2.7, it should be changed to:

    export PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH"

    Press Command + s to save.

    Open the terminal and enter source ~ /. Bash_ Profile , execute the file.

    Finally, you can enter echo $path on the terminal to see if the environment variable is added.

    You can see that /library/frameworks/python.framework/versions/2.7/bin has been added ( and many ).

    Finally, enter scapy and you can finally use it!!!

The MAC installation yosys encountered an ‘dyld: malformed mach-o image’ error

Instead of brew install yosys, I build from source because I don’t know how to use brew.

I didn’t have any problems with readme, make and make install (which surprised me. You know, it seems difficult for me to compile c code on MAC)

Running yosys, an error was encountered:

dyld: malformed mach-o image: dylib load command #13 string extends beyond end of load command
Abort trap: 6

I’m glad that a powerful person encountered the same problem. Thank you for seeing this issue. I think it’s difficult for others to meet it. It’s a strip problem. Make install executed the strip command. It doesn’t matter. The problem is that the strip on this machine is not a strip provided by Xcode, but a GNU strip installed by brew. It probably doesn’t consider the MAC format, resulting in a strip error.

Solution: remove the place where the strip is executed in the makefile. Or delete the symlink of the strip in the path, so that the strip points to/usr/bin/strip again. This is dedicated to the Mac platform, so there will be no error

Mac environment and python + selenium environment are built to solve the error reporting problem of chromedriver

####

Create a new Python virtual environment and install selenium

Create a new Python project,

####

from selenium import webdriver

driver = webdriver.Chrome()

driver.get("https://www.baidu.com")

###

report errors:

‘chromedriver’ executable needs to be in PAT

###

What should I do?

Download chromedriver

Step 1: check your browser version and enter the URL: chrome://version/

Step 2: download the corresponding version of chromedrive at: http://chromedriver.storage.googleapis.com/index.html

Step 3: put the package under the project directory,

Step 4: modify the code and add the file path of drive,

Here is the code:

###

from selenium import webdriver

driver = webdriver.Chrome(executable_path="./chromedriver")

driver.get("https://www.baidu.com")

###

Then you can play happily. As long as you master the positioning and various operation APIs, you can basically get started and do your own projects,

 

###

 

 

 

 

####

Mac installation mat error [How to Solve]

The installation mat reports an error, prompting to check the error log in the path /.eclipse/1528649425_macosx_cocoa_x86_64/configuration/1539332382530.log

The reason is /private/var/folders/k4/knjt7v5x59l25z_tqmvg094r0000gn/T/AppTranslocation/3CBB3175-DD9A-4A3A-B93F-898BA4445384/d/mat.app/ Contents/MacOS/workspace/.metadata is a read-only file and requires the following parameter in the MemoryAnalyzer.ini file

1. Right click on the installation package to show the package contents
2. Go to the eclipse folder and find MemoryAnalyzer.ini
Enter
-data
/Users/your username/mat-log

 

Notes:

The data parameter and path must be on two different lines
The data parameter must be placed before the launcher

 

Troubleshooting MySQL Python error on MAC

Error in installing MySQL pyhton on MAC

Today, I reported an error when installing MySQL Python on MAC , searched the network and said that there was a problem with the MySQL config path, but it didn’t work

Solution

The initial problems were:

Complete output from command python setup.py egg_info:
sh: mysql_config: command not found
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/jy/7ybw8dpj71n9yhk_xj5jttxc0000gn/T/pip-install-NknW3b/MySQL-python/setup.py", line 17, in <module>
    metadata, options = get_config()
  File "setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
  File "setup_posix.py", line 25, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/jy/7ybw8dpj71n9yhk_xj5jttxc0000gn/T/pip-install-NknW3b/MySQL-python/

 

After searching, I found that brew install mysql-connector-c , install brew install mysql-connector-c ,
reinstall MySQL Python , and found that an error was still reported, but the error information changed:

Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/jy/7ybw8dpj71n9yhk_xj5jttxc0000gn/T/pip-install-u39xuY/MySQL-python/setup.py", line 17, in <module>
    metadata, options = get_config()
  File "setup_posix.py", line 53, in get_config
    libraries = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("l")) ]
  File "setup_posix.py", line 8, in dequote
    if s[0] in "\"'" and s[0] == s[-1]:
IndexError: string index out of range

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/jy/7ybw8dpj71n9yhk_xj5jttxc0000gn/T/pip-install-u39xuY/MySQL-python/

I searched the Internet, but the solutions were wrong. Finally, I found that there was a configuration problem with mysql-connector-c , so I modified the file

/usr/local/Cellar/mysql-connector-c/6.1.11/bin/mysql_config:

 

cd /usr/local/Cellar/mysql-connector-c/6.1.11/bin/
cp mysql_config mysql_config.bak
sudo vim mysql_config

# Create options
libs="-L$pkglibdir"
# libs="$libs -l "
libs="$libs -lmysqlclient -lssl -lcrypto "

Then reinstall pip install MySQL-python, Done!

Mac open terminal error – bash:: command not found

Problem Description:

The MAC system reports an error – bash:: command not found when opening terminal

Problem analysis:

Error reporting does not affect the use of terminal, so it is ignored. But I’m modifying. Bash_After the profile file, in order to make the configuration effective, use the source command, which also reports an error – bash:: command not found

At first, I thought that the source command could not be found, added/bin to the environment variable, or reported this error

The problem is in trouble

In the online search, we found that most of the problems are similar to – bash: nginx: command not found, that is, there is a command between the two:: but the specific command cannot be found. The current error report does not see this command, but a space. It means that the space is also regarded as a command, which means. Bash_A space is written in the profile, which is considered to be executed by the system as a command

Open. Bash_Profile, no space is seen. Copy the file content to the text editor, and no space is seen

For troubleshooting, we intend to comment out all commands, release the command line by line, and then execute the source command to see which line reports an error. Found that the workload was too heavy

Inadvertently opening. Bash with vs Code_Profile, an exception is found, as follows:

Remove this special character and select source again. No more errors will be reported

It can be seen that the system executes this special character as a command, but the command cannot be found, and the command is displayed as a space in the terminal, so the above error is caused

Summary:

1. We should draw inferences from one instance, see the difference between other people’s problems and our own problems, and compare the problems

2. Pay attention to special characters and try to use a rich text editor, such as vs code

 

Error in Python compilation on MAC no module named mysqldb

Compile error for python on Mac: No module named MySQLdb

You installed python

You did brew install mysql

You did export PATH=$PATH:/usr/local/mysql/bin

And finally, you did pip install MySQL-Python

appear:

Collecting mysql-python
Downloading MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 112kB 324kB/s
Complete output from command python setup.py egg_info:
sh: mysql_config: command not found
Traceback (most recent call last):
File “<string>”, line 1, in <module>
File “/private/tmp/pip-build-fwrZHD/mysql-python/setup.py”, line 17, in <module>
metadata, options = get_config()
File “setup_posix.py”, line 43, in get_config
libs = mysql_config(“libs_r”)
File “setup_posix.py”, line 25, in mysql_config
raise EnvironmentError(“%s not found” % (mysql_config.path,))
EnvironmentError: mysql_config not found

Solution:

Reinstall MYSQL