Tag Archives: pip

Solution of CONDA (PIP) bad interpreter

because of the change of server, I moved the conda environment used in the original server directly to the new server. As a result, the “Conda (PIP) bad Interpreter” error appeared when using the conda(PIP) command on the new server. The solution:

  • enter which PIP view PIP path
  • enter which python view python path
  • use vim to open the PIP path (or python path) that you have just obtained. Change the path in the first line of the code to be the same as the PIP path.

Python installation problem: error: Command erred out with exit status 1:

Try to run this command from the system terminal. Make sure that you use the correct version of ‘PIP’ installed for your Python interpreter located at “C: \ Users \ \ PycharmProjects \ pythonProject \ 123 venv \ Scripts \ python exe. ‘

this problem occurs because the Python version installed is relatively new and there is no PIP for the corresponding version. The solution is to install the older version. The author installed version 3.9, and the problem of installing version 3.8 is solved.

The PIP installation package was successful but the import failed

the problem I ran into was not installing the package in the virtual environment, taking the jieba package as an example

enter python in the virtual environment, and then you can import the package. We thought it was packaged, but it was actually installed in the basic environment.

When

USES conda list to view the packages in the current environment, there is no jieba package.

conda list

forgot the screenshot,,,,

so you need to install jieba using the PIP of the virtual environment.


after confirming wrapping in a virtual environment, switching to a python environment cannot be done by simply typing python commands. Instead, use virtual environment Python, just like the previous PIP.

for example, you now have two files, test.py and test.sh.

test.py

import torch
print(torch.__version__)

test.sh

python test.py

you can see that the PIP version printed in the virtual environment is different from the one printed in the bash script.

so while I installed jieba in the pytorch1.4 environment, the command I used directly was not python in pytorch1.4, but python in the base environment.

summary:

  1. whether the package to the environment
  2. used the python interpreter is not the package environment interpreter

there are a lot of ways to do it online, so this is a supplement to what’s possible.