Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to pip install pickle in python 3.6

I am trying to run the following code:

import bs4 as bs import pickle import requests import lxml  def save_sp500_tickers():     resp = requests.get("https://en.wikipedia.org/wiki/List_of_S%26P_500_companies")     soup = bs.BeautifulSoup(resp.text, "html5lib")     table = soup.find("table", { "class" : "wikitable sortable"})      # print(soup)     # print(soup.table)      tickers = []     for row in table.findAll("tr")[1:]:         ticker = row.findAll("td")[0].text         tickers.append(ticker)     with open("sp500tickers.pickle","wb") as f:         pickle.dump(tickers, f)     print(tickers) #   return tickers # save_sp500_tickers() 

It does not throw any error but I realized the pickle module is not installed. I tried to install it via pip and got the following error:-

D:\py_fin>pip install pickle Collecting pickle   Could not find a version that satisfies the requirement pickle (from versions:  ) No matching distribution found for pickle 

How do we install pickle in python 3.6 (32-bit)?

like image 701
satyaki Avatar asked Jan 27 '18 16:01

satyaki


People also ask

Do I need to pip install pickle?

pickle is part of the standard library, so there is no need to pip install it.

How do I manually install pip in Python?

Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed. Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists. Step 4: Now wait through the installation process.


1 Answers

pickle module is part of the standard library in Python for a very long time now so there is no need to install it via pip. I wonder if you IDE or command line is not messed up somehow so that it does not find python installation path. Please check if your %PATH% contains a path to python (e.g. C:\Python36\ or something similar) or if your IDE correctly detects root path where Python is installed.

like image 158
sophros Avatar answered Oct 07 '22 11:10

sophros