1.問題發(fā)生
最近在研究selenium時,碰巧需要裝configuration包,于是乎用pip在命令行安裝
?結(jié)果報了:
Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [6 lines of output] Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "C:\Users\Administrator\AppData\Local\Temp\pip-install-7uh8r2t5\configuration_a37d2a431105423c8797f1fceee8d6c2\setup.py", line 30, in <module> description = file(os.path.join(here, 'README.txt')).read() NameError: name 'file' is not defined [end of output]
2.問題解決
2.1 上網(wǎng)查瀏覽器
于是開始上瀏覽器搜,一開始全是升級setuptools,這里貼出來幾句,可能你們的問題就解決了
pip install --upgrade pip
pip install --upgrade setuptools
pip install ez_setup
可我把這些執(zhí)行了一遍,沒解決問題,只是少了幾行錯(上面的圖不是最開始的錯)。
2.2 手動下載包解決
后面我想會不會是安裝源的問題,仔細看,我報錯的下面幾行,提示源碼錯誤(setup.py line 30)于是乎,找了國內(nèi)流行的幾個pip源(這里也給你們粘出來)
常見pip鏡像源(國內(nèi)源)
清華:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/
華中理工大學:http://pypi.hustunique.com/
山東理工大學:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/
我準備對比一下這幾個源下的包有什么不同,打開了清華源和豆瓣源,按ctrl+f 輸入configuration,點進去會有各個時期的版本,大概是這樣(豆瓣源)
?我下載了最新的0.4版本的。
之后便是解壓,查看setup.py文件的第三十行代碼,發(fā)現(xiàn)description不重要,于是直接給注釋了(
#description = file(os.path.join(here, 'README.txt')).read()
),注意修改后 ctrl+s 保存,后面又提示,我在方法上面加了一句,參考下圖
description = ''
Traceback (most recent call last):
File "setup.py", line 38, in <module>
long_description=description,
NameError: name 'description' is not defined
?2.3 使用pip安裝本地包
具體參考這篇文章
python使用pip安裝本地包-Python之pip使用詳解|附第三方庫安裝總結(jié)_weixin_37988176的博客-CSDN博客
我使用了2.離線安裝
Step1:首先在https://pypi.org/下載需要的安裝包
Step2:解壓縮該文件。
Step3:命令行工具cd切換到所要安裝的包的目錄,找到setup.py文件,然后輸入python setup.py install安裝
3.結(jié)果展示
?成功安裝,且pycharm里導入不報錯
?文章來源地址http://www.zghlxwxcb.cn/news/detail-807555.html文章來源:http://www.zghlxwxcb.cn/news/detail-807555.html
?
到了這里,關于pip install configuration 報錯,問題大同小異(已解決)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!