Build a collection of environmental problems (jupyter lab and pycharm)

1. Where does the python console find the project mapping location?

import os
print(os.getcwd())

 2. Run the command on the Linux terminal, Ctrl+c & Ctrl+z

In Linux, the Ctrl + Z key combination can suspend the currently running process and put the process in the background for execution .

The function of Ctrl+c on the Linux command line is to terminate the program being executed . This kind of program is generally a program that has obtained the control authority of the console. After you press this button, the current program will terminate and exit.

If you want to terminate the program that is running in the background, entering this key combination in the console has no effect, you can use the command kill or killall at this time.


3. The command to create a new folder in Linux

Sudo mkdir anaconda3

4. Use Xtfp software to upload the anaconda installation package to the anaconda3 folder, if Xftp shows no permission

On the terminal command line, execute the permission command to modify the root directory

sudo chmod 777 foldername

 5. Execute the bash Anaconda3-2023.03-Linux-x86_64.sh command, enter enter and yes

6. How to modify the default path of anaconda3

7. Perform global configuration

vim ~/.bashrc

#Add the absolute path of anaconda3/bin at the end of the article

export PATH=$PATH:/anaconda/anaconda3/bin

Set to the next-level directory /bin of the anaconda path installed by yourself

Enter source ~/.bashrc after modification to make the configuration take effect.

Enter conda -V display

can be installed successfully


Configure jupyterlab remote access and solve common problems, kernel modification - R=(1-sinθ) - Blog Garden (cnblogs.com)  (1 message) The second step of scientific research: run the program on the server remotely using jupyter_remotely using jupyter _Wuya's Blog-CSDN Blog

8. After the configuration of jupyter lab or jupyter notebook is completed, the server cannot be accessed in the local browser

In the shell on the local host ( Eg. use MobaXterm to create a new shell ) enter

ssh -p remote_port remote_user@remote_ip -L127.0.0.1:1234:127.0.0.1: the port of the server jupyter notebook

Replace #remote_user@remote_ip with the actual remote account and remote address

#1234 can be changed to an unused port number between 1024-65535

#-L means local mapping forwarding

 ssh -p server port user@ip address -L127.0.0.1: random port: 127.0.0.1: server port

 

 Open a browser on the local host, enter 127.0.0.1:1234 in the address bar to access remotely

Reference blog:

https://www.jianshu.com/p/2fc5545901c7

The configuration of Jupyter notebook is fine, but it cannot be accessed remotely. The solution_Jupyter fills in the parameters and still cannot access remotely_DyingCZ's blog-CSDN博客


 9. Kill the process name, the process pid keeps changing

To return the process number of a process through the command ps -aux | grep process name, and then kill the improved process through kill, in this process, if grep cannot match the correct process number, grep itself will generate a (not corresponding The process number of the process), and the pid of this information has been changing.

ps -aux | grep jupyter

To get rid of an output generated by grep itself, add -v grep after the command: ps -aux | grep app | grep -v grep

How to extract the pid from the result of ps aux?

If we want to take out the PID and use it for subsequent operations, such as kill, we should first use the tr command to compress the spaces between each column, compress multiple spaces into one, and then use the cut command to split the columns according to the spaces And take out the value of the second position, which is PID. The result is then fed to the kill command. As follows:

kill $(ps aux | grep process name | tr -s ' ' | cut -d ' ' -f 2)

Original link: ps -aux | grep Process name: Process pid keeps changing_ps aux | grep pid_Nick_Zhang_123's Blog-CSDN Blog

 


10.  Add virtual environment to Jupyter notebook/lab

python -m ipykernel install --user --name tf27【virtual environment name】 --display-name TF27【jupyter browser name】

python -m ipykernel install --user --name [virtual environment name] --display-name [environment name you want to display on jupyter]

11、$ git clone https://github.com/microsoft/SmartKG.git

Cloning into 'SmartKG'...

fatal: unable to access 'https://github.com/microsoft/SmartKG.git/': Proxy CONNECT aborted

 (1 message) Solve git download error: fatal: unable to access 'https://github.com/.../.git/':_nickname 999's blog-CSDN Blog


12,  ubuntu articles --- file compression and decompression

tar zxvf /cars_test.tgz -C /cars_test

13.  Restore the default Ubuntu source

 conda config --remove-key channels

 

 14、

(1 message) Solve the situation that Python uses pip to install library files with "Error: Cannot unpack file..."_WY_Matcha's Blog-CSDN Blog

(py37-paddle) D:\1-F>pip install paddlenlp==2.3.2 https://pypi.tuna.tsinghua.edu.cn/simple

Collecting https://pypi.tuna.tsinghua.edu.cn/simple

  Downloading https://pypi.tuna.tsinghua.edu.cn/simple (27.0 MB)

     ----------------------------------------- 27.0/27.0 MB 3.6 MB/s eta 0 :00:00

  ERROR: Cannot unpack file C:\Users\Chen\AppData\Local\Temp\pip-unpack-0_54xdjg\simple.htm (downloaded from C:\Users\Chen\AppData\Local\Temp\pip-req-build-8z2_eyx9, content-type: text/html); cannot detect archive format

ERROR: Cannot determine archive format of C:\Users\Chen\AppData\Local\Temp\pip-req-build-8z2_eyx9

(py37-paddle) D:\1-F>pip install -i https://pypi.tuna.tsinghua.edu.cn/simple paddlenlp==2.3.2

 

 

Guess you like

Origin blog.csdn.net/weixin_43717681/article/details/130410205