Anaconda
Environment
Activate an environment:
conda activate en_name
#or
source activate en_name
Deactivate an environment:
conda deactivate en_name
#or
source deactivate en_name
Create a new environment:
conda create -n env_name python=x.x
List all the existing environment:
conda env list
Delete an existing environment:
conda remove --name env_name --all
requirement.txt :
generate by running:
pip install pipreqs
pipreqs .
or
conda list -e > requirements.txt
install by running:
conda install --yes --file requirements.txt
if there is a setup.py file, then running this:
pip install -e .
Run .py in the Terminal
error: undefined symbol: cublasLtHSHMatmulAlgoInit, version libcublasLt.so.11
export LD_LIBRARY_PATH=/home/linchangyi/anaconda3/envs/pytorch/lib/python3.7/site-packages/nvidia/cublas/lib/:$LD_LIBRARY_PATH
Pycharm
Create a Python interpreter:
File -> Settings -> Project:xxx -> Python Interpreter ->
Add Interpreter -> Virtualenv Environment:
Environment: Existing
Base interpreter: /home/user_name/anaconda3/envs/env_name/bin/python3.x
Create a setup.py:
File -> Tools -> Create setup.py
Add the ROS Python path for using ros in python:
1. Choose the Python interpreter used;
2. Choose 'show interpreter paths';
3. Add the ROS Python path like '/opt/ros/noetic/lib/python3/dist-packages'.
No module named ‘rospkg’
pip install rospkg
pip install pycryptodomex
pip install gnupg
Cannot find reference ‘VideoCapture’ in ‘init.py’
1. Choose the Python interpreter used;
2. Choose 'show interpreter paths';
3. Add the cv2 package path like '/home/user_name/anaconda3/envs/env_name/lib/python3.x/site-package/cv2'.
Better way to install OpenCV with QT
conda install opencv
QObject::moveToThread: Current thread (0x3cf61d0) is not the object’s thread (0x3bfb990)
Just delete other virtual anaconda environments in the Pycharm -> Settings -> Project -> Python Interpreter.
Installation
Pip:
# install
pip install lib_name
# uninstall
pip uninstall lib_name
Conda:
# install
conda install lib_name
# uninstall
conda uninstall lib_name
PyBullet
Previously, I used “pip3 install pybullet” or “conda install pybullet” and couldn’t use “import pybullet”
in PyCharm.
So, go to the official website of Anaconda and search “pybullet”.
The result is:
conda install -c conda-forge pybullet