天天看點

pip 常用指令安裝python包常用指令

安裝python包常用指令

建立虛拟環境

conda create -n your_env_name python=3.6.8

激活虛拟環境

activate your_env_name

使用清華鏡像安裝包

pip install xxx -i https://pypi.tuna.tsinghua.edu.cn/simple

常用鏡像位址:

  1. http://mirrors.aliyun.com/pypi/simple/ 阿裡雲
  2. https://pypi.mirrors.ustc.edu.cn/simple/ 中國科技大學
  3. http://pypi.douban.com/simple/ 豆瓣
  4. https://pypi.tuna.tsinghua.edu.cn/simple/ 清華大學
  5. http://pypi.mirrors.ustc.edu.cn/simple/ 中國科學技術大學

安裝固定版本的包

pip install xxx==2.8.0

更新包到固定版本

pip install --upgrade xxx==2.8.0

timeout

pip --default-timeout=10000 install -U xxx

清華鏡像timeout

pip --default-timeout=10000 install xxx -i https://pypi.tuna.tsinghua.edu.cn/simple

Cannot unpack file

pip install --default-timeout=1000 xxx -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn

Command “python setup.py egg_info” failed with error code 1

pip install --default-timeout=1000 Shapely -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn

安裝pyspark

當pip不上的時候,到官網 http://spark.apache.org/downloads.html 上下載下傳spark-2.3.1-bin-hadoop2.7.tgz,解壓後,将\spark-2.3.1-bin-hadoop2.7\python 目錄下 pyspark ,pyspark.egg-info ,這兩個檔案夾複制到anaconda的site-packages檔案夾中就可以了