无法在python 3.6中pip安装pickle [英] Not able to pip install pickle in python 3.6
问题描述
我正在尝试运行以下代码:-
I am trying to run the below 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()
它不会引发任何错误,但是我意识到没有安装pickle模块. 我去通过点子安装它并得到以下错误:-
it does not throws any error but i realized pickle module is not installed. I went to install it via pip and getting below 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
我尝试过用google搜索,但没有找到解决方案.请帮忙. 我们如何在python 3.6(32位)中安装pickle
I tried google'd about it but did not get a solution. Please help. How do we install pickle in python 3.6(32-bit)
推荐答案
pickle
模块很长时间以来一直是Python标准库的一部分,因此无需通过pip
进行安装.我想知道您的IDE或命令行是否没有以某种方式弄乱,以至于找不到python安装路径.请检查您的%PATH%
是否包含python的路径(例如C:\Python36\
或类似名称),或者您的IDE是否正确检测到安装了Python的根路径.
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.
这篇关于无法在python 3.6中pip安装pickle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!