Python: pip through the installation of third-party packages still can not import (2)

Before I wrote an article about how to solve this problem, which had read " Python: pip through the installation of third-party packages still can not Import ", which refers to only one method: download third-party package of compressed files, and then by  python setup install .py  . This approach may be applicable to a part of the package, but for a number of do not know where to download the compressed file in the package, you need to use other methods.

After a long time useless Python, Python environment on the computer I had some problems, so I downloaded several packages can not import properly, I finally found the problem is less the definition of Python path.

 

When my MacOS system to xlwt for example, as follows.

1. Perform  PIP3 install xlwt  (I need to install the package to the Python environment 3, so use pip3), if the package has been successfully installed, the path where the package appears.

 

 

2. Open ~ / .bash_profile (Available  the sudo VI ~ / .bash_profile  open file editing), add the following path within quotation marks on the display step.

PYTHONPATH="/usr/local/lib/python3.7/site-packages"
export PYTHONPATH

3. Run  Source ~ / .bash_profile  .

Guess you like

Origin www.cnblogs.com/zhenqichai/p/pip-install-successfully-module-not-found-error-2.html