This is the 12th day of my participation in the August More Text Challenge. For details, see:August is more challenging

Share how to resolve version conflicts when using Anaconda earlier this year. Before Anaconda, the default Python2 was used without special Settings, and later python needs to be upgraded.

The main problem is that the new package only supports Python3, so I have to upgrade…

Using commands directlybrew upgrade pythonupgrade

This command downloads dependencies during the installation process, as well as the stable version of Python3.

Operation time out problem

If an error occurs: Failed to connect to www.python.org port 443: Operation timed out

ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host=’files.pythonhosted.org’, port=443)

This is mainly a network issue and it is recommended to retry the BREW upgrade command after several retries

Xcode-select problem encountered

Run xcode-select –install.

The brew installation process requires some Xcode dependencies.

After upgrading Python3, I found that the terminal input python -v, and the output is still 2.7

If python3 is installed on brew, restart a terminal and enter Python -v, and it still displays 2.7.

Brew install has been installed…

This is because anaconda has been installed on the system before. Check the. Bash_profile file and find that the source of conda.sh is advanced and the path variable is passive.

You need to comment out the part of the bash profile where conda sets PATH.

Or add it directly to the last line of the ~/.bash_profile in the bash profile. For version 3.8, see the following:

exportPATH = / Library/Frameworks/Python framework Versions / 3.8 / bin:$PATH
Copy the code

 

The old PIP also needs to be upgraded

DEPRECATION: Python 2.7 is deprecated at the end of its life.

Upgrade is strongly recommended, otherwise some projects will get an error like socket.timeout: The read operation timed out when using The PIP command.

python -m pip install –upgrade pip

Or the full path:

/usr/local/bin/python -m pip install –upgrade pip

  

Older versions of VirtualEnv need to be upgraded

The virtualenv command can be used, but there is no error, incompatible, direct upgrade.

To upgrade virtualenv, use the PIP command:

pip install –upgrade virtualenv

Virtualenv Creates a virtual environment