本来python用的好好的,我想备份一下安装包,就把包复制到了另一个文件夹下,结果各种报错不能用,坑~
改了pycharm的各种配置终于好了。结果python3需要安装pip。
安装命令:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
安装pip时遇到的问题:
sh-3.2# python3 get-pip.py
出现如下提示
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools’ objects directly or at least import Setuptools first.
warnings.warn(
Configuration file could not be loaded.
File contains no section headers.
file: ‘/var/root/.pip/pip.conf’, line: 1
‘pip install -i https://pypi.douban.com/simple\n’
解决办法:
打开pip.conf文件
vi pip.conf
然后在第一行加上
[global]
保存退出就可以了
然后去执行脚本,向Kafka发送数据。结果又报错
kafka报错:
解决办法:
使用最新的kafka版本,但是pyPI上的kafka还没有被替换成最新的,可以使用下面的方法升级kafka python
pip install kafka-python