微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

pip install“numpy”导致android chaquopy错误

如何解决pip install“numpy”导致android chaquopy错误

嗨,我一直在尝试使用 chaquopy 来运行我的 python 脚本,但在导入部分时遇到了问题。当我运行不需要任何外部库的脚本并且不使用您将在 build.gradle 中编写的安装代码时,它工作正常。

        python{
            pip{
                install "numpy"
            }
        }

我一插入安装代码,问题就出现了。它出现了下面写的错误消息。

> Task :app:generateDebugPythonRequirements
C:\Users\q\AndroidStudioProjects\Chaquopy_Practice\app\build\generated\python\bp.zip\pip\_vendor\ipaddress.py:1106: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
C:\Users\q\AndroidStudioProjects\Chaquopy_Practice\app\build\generated\python\bp.zip\pip\_vendor\ipaddress.py:1106: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
Chaquopy: Installing for armeabi-v7a
C:\Users\q\AndroidStudioProjects\Chaquopy_Practice\app\build\generated\python\bp.zip\pip\_vendor\ipaddress.py:1106: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
C:\Users\q\AndroidStudioProjects\Chaquopy_Practice\app\build\generated\python\bp.zip\pip\_vendor\ipaddress.py:1106: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
pip is configured with locations that require TLS/SSL,however the ssl module in Python is not available.
Looking in indexes: https://pypi.org/simple,https://chaquo.com/pypi-7.0
Collecting numpy
  retrying (Retry(total=4,connect=None,read=None,redirect=None,status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  retrying (Retry(total=3,status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  retrying (Retry(total=2,status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  retrying (Retry(total=1,status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  retrying (Retry(total=0,status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  Could not fetch URL https://pypi.org/simple/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org',port=443): Max retries exceeded with url: /simple/numpy/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  retrying (Retry(total=4,status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /pypi-7.0/numpy/
  retrying (Retry(total=3,status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /pypi-7.0/numpy/
  retrying (Retry(total=2,status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /pypi-7.0/numpy/
  retrying (Retry(total=1,status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /pypi-7.0/numpy/
  retrying (Retry(total=0,status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /pypi-7.0/numpy/
  Could not fetch URL https://chaquo.com/pypi-7.0/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='chaquo.com',port=443): Max retries exceeded with url: /pypi-7.0/numpy/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy
Chaquopy: Exit status 1

我认为 SSLError 发生在其他一些人身上,但我找不到 SyntaxWarning: 'str' object ~~ 是关于什么的。

解决方法

问题本身不在 pip install 命令中。 真正的问题来自于使用 anaconda 的 python.exe 而不是原始的 python.exe。 下载python 3.8.6并更改buildpython路径后,我能够解决问题。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。