一、安装Anaconda

Anaconda是一个开源的包、环境管理器,可以用于在同一个机器上安装不同版本的软件包及其依赖,并能够在不同的环境之间切换。

Anaconda包括Conda、Python以及一大堆安装好的工具包,比如:numpy等

1、安装完成后启动

2、修改Anaconda镜像地址

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

3、安装jpype1-手动方式

自动方式安装(pip install jpype1)会报错,选择手动方式; Anaconda已自带wheel不须再安装

下载.whl文件:JPype1-0.6.3-cp37-cp37m-win_amd64.whl

下载路径:https://www.lfd.uci.edu/~gohlke/pythonlibs/#jpype

安装:pip install C:\Users\gaogao\Downloads\JPype1-0.6.3-cp37-cp37m-win_amd64.whl

二、安装PyCharm

1、设置字体及大小

File->Settings

三、报错汇总

1、ModuleNotFoundError: No module named 'jpype'

解决:python 中调用java代码需要安装 jpype1 。

 2、ImportError: numpy.core.multiarray failed to import

解决:python 安装numpy。

3、报错:numpy-1.16.1+mkl-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform.

解决:python版本位数与whl文件位数要保持一致.(本地python32位换成64位)

4、打包成exe后执行闪退

解决:将.exe文件手动到DOS窗口可查看日志

5、 error: Microsoft Visual C++ 14.0 is required.

Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

解决:安装jpype时报的错,由于c++依赖库不存在,所以在对包进行编译的时候出错,故我们可以去直接下载二进制安装包进行安装。(即自动方式安装)

6、 Could not install packages due to an EnvironmentError: [WinError 5]

权限不足,需要管理员身份运行

拒绝访问。:

'c:\\program files\\python37\\lib\\site-packages\\pip-18.1.dist-info\\entry_points.txt'

Consider using the `--user` option or check the permissions.

解决一:使用C:\Windows\System32 文件夹下面的cmd.exe

解决二:python -m pip install --upgrade pip改成python -m pip install --user --upgrade pip

7、 打包好的exe执行报错:

ImportError: numpy.core.multiarray failed to import

解决方法01,改变控制台的编码格式为utf-8,在控制台中输入 chcp 65001,然后再使用pyinstaller -D  xxx.py 打包成功。

解决方法02:源代码中startJVM的顺序调整一下:

app = App(root)

classpath = os.path.join(os.path.abspath('.'), './')
startJVM(getDefaultJVMPath(), "-ea", "-Djava.class.path=%s" %(classpath))
javaClass = JClass('Test')
#问题根因是App()实例初始化在startJVM之后导致的。

解决方法03:将打包好的文件夹先拷贝到其他盘(不要在C盘),再以管理员身份运行

8、No matching distribution found for pyinstaller

Could not find a version that satisfies the requirement pyinstaller (from versions: )

No matching distribution found for pyinstaller

解决:网络慢,可通过镜像下载:

pip install pyinstaller -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

9、Pip install jpype1 报错

building '_jpype' extension

error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools":

解决:下载visualcppbuildtools_full.exe

10 jpype._jexception.RuntimeExceptionPyRaisable: java.lang.RuntimeException: Class Test not found

说明:python脚本中有调用java class文件Test.class
打包好的python程序,执行exe后报错: jpype._jexception.RuntimeExceptionPyRaisable: java.lang.RuntimeException: Class Test not found
C:\Users\Administrator>D:\test\my_test.exe
Traceback (most recent call last):
  File "my_test.py", line 57, in <module>
  File "site-packages\jpype\_jclass.py", line 73, in JClass
jpype._jexception.RuntimeExceptionPyRaisable: java.lang.RuntimeException: Class Test not found
[5876] Failed to execute script my_test
解决:
1.将打包后压缩包不要放到C盘,放到其他盘,然后解压
2.使用管理员方式运行
 

Python_环境部署及报错汇总(0)的更多相关文章

  1. JDK1.8环境下依然报错 Unsupported major.minor version 52.0

    JDK1.8环境下依然报错 Unsupported major.minor version 52.0 在配置elasticsearch-rtf全文搜索引擎时,按照Github上项目readme.md来 ...

  2. Maven-008-Nexus 私服部署发布报错 Failed to deploy artifacts: Failed to transfer file: ... Return code is: 4XX, ReasonPhrase: ... 解决方案

    我在部署构件至 maven nexus 私服时,有时会出现 Failed to deploy artifacts: Failed to transfer file: ... Return code i ...

  3. Python_爬虫 Scrapy 安装报错一整套处理流程

    安装顺序 scrapy 需要的依赖很多.首先需要   twisted  如果没有这个 直接安装  scrapy  会报错 要求你安装一个 vis 14 还是什么的环境,那个东西如果真的要装要 6g 但 ...

  4. Ambari集成Kerberos报错汇总

    Ambari集成Kerberos报错汇总 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.查看报错的配置信息步骤 1>.点击Test Kerberos Client,查看相 ...

  5. Ubuntu操作系统编译安装zabbix报错汇总

    Ubuntu操作系统编译安装zabbix报错汇总 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.报错提示:"configure: error: MySQL libra ...

  6. Python2.7在Windows下CMD编码为65001/utf-8时print报错[Errno 0]/[Errno 2]

    使用python2.7处理unicode的字符串,环境变量已设置PYTHONIOENCODING为utf-8,cmd编码为utf-8时print unicode字符串会报错[Errno 0]或[Err ...

  7. selenium报错汇总

    selenium报错汇总 报错:[error] Could not connect to Selenium Server. Have you started the Selenium Server y ...

  8. Tomcat6环境JBPM4.4报错:java.lang.ClassNotFoundException: de.odysseus.el.util.SimpleResolver

    Tomcat6环境JBPM4.4报错:java.lang.ClassNotFoundException: de.odysseus.el.util.SimpleResolver 报错信息:

  9. jmeter Linux环境执行总报错 cannot allocate memory

    1.windows环境写好的测试用例,执行没有问题,在Linux环境跑总是报错,提示如下 cannot allocate memory 2.一开始以为是哪块设置有问题,因为脚本里边有设置邮件自动发送, ...

随机推荐

  1. 对于 url encode decode js 和 c# 有差异

    在js对一个值进行解码使用:decodeURIComponent,编码使用:encodeURIComponent

  2. XSS跨站脚本小结(转)

    原文链接:http://www.cnblogs.com/xiaozi/p/5588099.html#undefined XSS漏洞验证经常遇到一些过滤,如何进行有效验证和绕过过滤呢,这里小结一下常见的 ...

  3. AICODER全栈实习报名

    三期班开始报名 三期班定于6月17日开班,实习费用如下: 三个月模式实习费为12000元. 一个月模式实习费为4500元. AICODER提供后付费模式,报名参加AICODER的线下实习3个月模式的朋 ...

  4. [转]tableExport.js 导出excel 如果有负数或是空值 导出前面会自动加上单引号

    原文地址:https://blog.csdn.net/private66/article/details/88718285 tableExport.js  导出excel  如果有负数或是空值 导出前 ...

  5. 你真的理解Python中MRO算法吗?[转]

    [前言] MRO(Method Resolution Order):方法解析顺序.Python语言包含了很多优秀的特性,其中多重继承就是其中之一,但是多重继承会引发很多问题,比如二义性,Python中 ...

  6. SpringMvc支持跨域访问,Spring跨域访问,SpringMvc @CrossOrigin 跨域[转]

    SpringMvc支持跨域访问,Spring跨域访问,SpringMvc @CrossOrigin 跨域 原文地址:https://www.cnblogs.com/fanshuyao/p/716847 ...

  7. 转载记录一个有效的jetbrains激活码

    来自:https://blog.csdn.net/ahun535915415/article/details/80687762 K03CHKJCFT-eyJsaWNlbnNlSWQiOiJLMDNDS ...

  8. Kafka中bootstrap-server、broker-list和zookeeper的区别

    参考 Kafka bootstrap-servers vs zookeeper in kafka-console-consumer  中说建议使用新版(新版本指的是kafka 0.8.0之后的版本)的 ...

  9. Android手机用wifi连接adb调试的方法

    https://www.jianshu.com/p/dc6898380e38 0x0 前言 Android开发肯定要连接pc的adb进行调试,传统的方法是用usb与pc进行连接,操作简单即插即用,缺点 ...

  10. c# httpclient

    using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; using System ...