我是Python的新手,我想在控制台中安装Jupyter Notebook,然后输入以下内容:
SW_HIDE = 0
Hide the window.
SW_MAXIMIZE = 3
Maximize the window.
SW_MINIMIZE = 6
Minimize the window.
SW_RESTORE = 9
Restore the window (not maximized nor minimized).
SW_SHOW = 5
Show the window.
SW_SHOWMAXIMIZED = 3
Show the window maximized.
SW_SHOWMINIMIZED = 2
Show the window minimized.
SW_SHOWMINNOACTIVE = 7
Show the window minimized but do not activate it.
SW_SHOWNA = 8
Show the window in its current state but do not activate it.
SW_SHOWNOACTIVATE = 4
Show the window in its most recent size and position but do not activate it.
SW_SHOWNORMAL = 1
Show the window and activate it (as usual).
之后,我在使用pip3安装其他库时出错,控制台打印:
pip3 install --upgrade pip
我不知道该怎么办。
在我使用File "/usr/bin/pip3", line 11, in <module>
sys.exit(main())
TypeError: 'module' object is not callable
之后,我使用sudo autoremove python3-pip
答案 0 :(得分:34)
从Bram的link开始,我刚运行python3 -m pip uninstall pip
,它又开始工作了。
答案 1 :(得分:2)
适合我的情况的解决方案是在ubuntu环境中简单地编辑pip3.8文件。
方法1:
#!/path/to/.venv/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal.main import main # <--- look at this import statement!
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
方法2:
主要功能必须导入,否则我们可以简单地替换行
sys.exit(main())
为
sys.exit(main.main())
答案 2 :(得分:1)
使用此
python -m pip install --upgrade --user [name_of_your_package]
答案 3 :(得分:1)
在Windows中,编辑C:\ ProgramData \ Anaconda3 \ Scripts \ pip-script.py并替换
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
用sys.exit(main.main())替换最后一行。
答案 4 :(得分:-1)
如here所示,您应该能够通过直接从Python运行模块来解决此问题,即
python -m pip install --upgrade pip