Tag Archives: Mac

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:



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()



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")



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
/Users/your username/mat-log



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


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



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

# Create options
# 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


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


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


Reinstall MYSQL


Mac download wepy error reporting solution

Today when downloading wepy-cli an error was reported

sudo npm i wepy-cli -g

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/.node-gyp'
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node" "--module_name=fse" "--module_path=/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /usr/local/lib/node_modules/wepy-cli/node_modules/fsevents
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)


I said I didn’t have permission. Why?I added sudo

After tossing for a long time, I found an order

sudo npm install –unsafe-perm -g wepy-cli

That’s it


A: for security reasons, NPM does not support running as root. Even if you run as root, NPM will automatically turn into a user named nobody, who has almost no permissions. In this way, if your script has some operations that require permissions, such as writing files (especially/root /. Node gyp), it will crash

In order to avoid this situation, either follow the rules of NPM and set up a high authority user for running NPM; Either add the — unsafe perm parameter, so that you will not switch to nobody. The user at runtime is the same user, even root


Error in installing MySQL Python on MAC [Solved]

Error Message:

EnvironmentError: mysql_config not found

Command “python setup.py egg_info” failed with error code 1 in /private/var/folders/nh/j05szmpj19368dd9_y6whgy40000gq/T/pip-install-n9Jonx/mysql-python/

I looked up the command to execute an environment variable online:

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

Then another error was reported:

#include “my_config.h”
1 error generated.
error: command ‘cc’ failed with exit status 1

Finally, I used two methods

One is to first execute :

brew install mysql

Be sure to install through brew

Second, download directly:


After downloading, you can access:

/ usr/local/mysql/bin    In this folder, you can see that there is a file called mysql_Config file


Since I did both things at the same time, I can’t judge which is right and which is wrong, or both, and then execute it again:

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

Latest run: Good install MySQL-Python


Error in connecting to MySQL via Navicat on MAC

After installing MySQL on the Mac, connect with Navicat, and a connection failure error will pop up in the connection test:

Client does not support authentication protocol requested by server; consider upgrading MySQL client


Find the following solutions online:

1.mysql -u root -p 2.use mysql; 3.alter user 'root'@'localhost' identified with mysql_native_password by '11111111'; 4.flush privileges;


    1. Root is the user name, localhost is the IP address, especially the local machine, mysql_native_Password is the old password verification mechanism, followed by the password for MySQL.

    2. Flush privileges: refresh the system permission related tables of MySQL.


As shown in the figure:

Back to Navicat, the personal test is successful!


Postscript: some netizens said that the new version would report this error. The MySQL I installed is the latest version 8.0.13. I don’t know if this is the reason.