1. Python integrated development Environment Pycharm How to install third-party libraries
http://blog.csdn.net/qiannianguji01/article/details/50397046
Sometimes you can't install third-party libraries, you can try using PIP to install
2. How the PIP command line installs third-party libraries
First of all, make sure you install Pip,cmd to hit Pip to find pip executable command
Pip Install Tushare
By default, the third-party libraries that PIP installs are in the Python executable directory:
In general, under the Python directory, for example, my Python is installed in:
C:\dev\Python\python361-32
Then the library installed via PIP will be in:
C:\dev\Python\Python361-32\lib\site-packages
The general Pip is installed by default when you install Python, but if you have more than one Python version, you can use Pip--version to see exactly which Python directory the PIP is in.
Pip Common Commands
# 安装package
pip install packagename
# 卸载package
pip uninstall packagename
# 查看所安装的package
pip
list
# 将项目依赖的库重定向输出到文件,cd到项目根目录
pip projectname > requirements.txt
# 他人安装项目的依赖库
pip install
-
r requirements.txt
# pip常用命令可通过在命令行输入pip -h查看
# pip command -h可查看该命令的使用方法
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages
in
requirements
format
.
list
List
installed packages.
show Show information about installed packages.
search Search PyPI
for
packages.
wheel Build wheels
from
your requirements.
hash
Compute hashes of package archives.
completion A helper command used
for
command completion
help
Show
help
for
commands.
But even if the third-party library is successfully installed, it is still possible that import cannot find a third-party library because import has a default search path
3. Import default search Path
Pythonpath is the Python search path, and by default our import module will be searched from the Pythonpath.
Use the following code to print Pythonpath:
Print (Os.sys.path)
How Python installs third-party libraries