Generally, the Linux system comes with two versions of python
by default. The versions that I follow with the virtual machine system are python2.7
and python3.2
, but due to personal habits, I like to use the new version of Python
for development. This will cause version conflicts when executing commands.
When I was about to execute a file that I wrote before, an error occurred. It is obvious that the requests
dependency is missing, and I will download and install the relevant dependency at this time.
But during the installation, I found that the dependencies I downloaded are stored in the dependency library corresponding to python2.7
by default, that is, after the download is complete, you still hold an error when you execute the python
file again, and the related dependency error is not found.
So what we need to solve now is that this relationship does not correspond to the problem
Query the location corresponding to the default python
which python
rm /usr/bin/python
which python3
ln -s /usr/bin/python3 /usr/bin/python
python -V
pip -V
requests
dependencies###I am here to download the designated mirror. By default, downloading foreign mirrors is slow and often interrupted.
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn requests
Start successfully
Recommended Posts