pip不会自行升级

时间:2018-07-16 14:20:31

标签: python pip upgrade

我无法将点(9.0.1)升级为点(10.0.1)。

运行

web3.eth.getTransactionCount(functioncalleraddress).then( (nonce) => {
        let encodedABI = contractInstance.methods.statechangingfunction().encodeABI();
 contractInstance.methods.statechangingfunction().estimateGas({ from: calleraddress }, (error, gasEstimate) => {
          let tx = {
            to: contractAddress,
            gas: gasEstimate,
            data: encodedABI,
            nonce: nonce
          };
          web3.eth.accounts.signTransaction(tx, privateKey, (err, resp) => {
            if (resp == null) {console.log("Error!");
            } else {
              let tran = web3.eth.sendSignedTransaction(resp.rawTransaction);
              tran.on('transactionHash', (txhash) => {console.log("Tx Hash: "+ txhash);});

抛出

pip install --upgrade pip

(这是另外一个问题,我需要处理...)

尝试

OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/EGG-INFO/PKG-INFO'

返回

pip install --user pip

并且无效,即Requirement already satisfied: pip in /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg 返回pip list | grep pip

运行

pip (9.0.1)

返回

pip install --upgrade --user pip

但是Successfully installed pip-10.0.1 仍返回pip list | grep pip

我已经学会了not to use sudo,所以请不要建议这一点。

This answer建议手动安装(或多或少)。但是我担心事情会变得混乱。

如果您建议使用虚拟环境,恐怕这对我来说太复杂了,因为我还是个初学者,如果某些方法无法正常工作,我应该找到它。找出尝试的方法更加艰巨。

真的没有其他选择吗?

1 个答案:

答案 0 :(得分:0)

您可以“安全”删除/Library/Python/2.7/site-packages/中的所有内容,除了:

$ cat Extras.pth 
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC

您可以从Finder(它会要求您提供管理员凭据)中进行操作,也可以与sudo rm配合使用-小心!

我建议在那里删除一切-应该删除以前用pipeasy_install安装的所有软件包-仅从那时起一直使用pip install --user,或者更好地从自制软件中使用pyenv获得Python 3并从那时开始使用虚拟环境。