学习或开发过程中遇到的问题集锦

背景

记录一下在学习或开发中遇到的问题和解决方法,当成备忘,不时更新。操作系统是win10

pip安装出错:Cannot uninstall 'xxx'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

解决方法:在python根目录下搜索所有xxx.egg-info文件,删除,而后重新用pip安装

pip安装速度过慢,发生readTimeoutException:

解决方法:在C:\Users\用户名目录下,新建pip目录,在pip目录里,新建pip.ini文件,添加如下内容,以设置国内镜像源

[global]  index-url = https://pypi.tuna.tsinghua.edu.cn/simple

idea刷新maven慢

步骤:1、修改maven安装目录\conf\settings.xml,在其中<mirrors>标签下增加阿里镜像

    <mirror>  
        <id>nexus-aliyun</id>  
        <mirrorOf>central</mirrorOf>    
        <name>Nexus aliyun</name>  
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>

2、在idea中File->Settings->Build,Execution,Deployment->BuildTools->Maven选项下,将User Setting File后面的Override选项打勾,再将其值改为上面的setting.xml的绝对路径

idea运行sbt项目:Waiting for lock on C:\Users\songzeceng\.ivy2\.sbt.ivy.lock to be available...

找到C:\Users\songzeceng\.ivy2\.sbt.ivy.lock这个文件,删了,刷新idea

安装pyspark时报错ERROR: Complete output from command python setup.py egg_info:

    ERROR: Could not import pypandoc - required to package PySpark

用pip安装pypandoc即可

idea运行scala:IllegalArgumentException: System memory 259522560 must be at least 471859200.

在Edit Configuration里添加运行参数-Xms128m -Xmx512m -XX:MaxPermSize=300m -ea

idea运行scala:IllegalArgumentException: Unsupported class file major version 55

Project Structure里指定jdk版本为1.8

idea运行spark:SparkException: A master URL must be set in your configuration

在Edit Configuration里添加运行参数SparkException: -Dspark.master=local

python打开文件报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 2: illegal multibyte sequence

指定编码格式是utf-8即可

f = open("filePath", mode="r", encoding="utf-8")

pynlpir.LicenseError: Your license appears to have expired. Try running "pynlpir update".

pynlpir的license过期,下载NLPIR.user文件(https://github.com/NLPIR-team/NLPIR/blob/master/License/license%20for%20a%20month/NLPIR-ICTCLAS%E5%88%86%E8%AF%8D%E7%B3%BB%E7%BB%9F%E6%8E%88%E6%9D%83/NLPIR.user),覆盖python-site-packages目录\pynlpir\Data目录下的原文件

python读文件报错AttributeError: module 'os' has no attribute 'mknod'

windows下没有mknod,改成普通的读文件即可

# os.mknod(output_path)

f_out = open(output_path, encoding="utf-8", mode='w')

pip install BeautifulSoup报错

    ERROR: Complete output from command python setup.py egg_info:
    ERROR: Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\SONGZE~1\AppData\Local\Temp\pip-install-gxg3o86b\BeautifulSoup\setup.py", line 22
        print "Unit tests have failed!"
                                      ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print(int "Unit tests have failed!")?
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in C:\Users\SONGZE~1\AppData\Local\Temp\pip-install-
gxg3o86b\BeautifulSoup\

改成BeautifulSoup4

pip install BeautifulSoup4

运行flutter一直卡在flutter Initializing gradle...

打开flutter安装目录\packages\flutter_tools\gradle\flutter.gradle文件,在仓库标签下,注释掉jcenter和google,添加国内镜像源

.....
buildscript {
    repositories {
        // google()
        // jcenter()
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
    }
}
.....

Android Studio报错License for package Android SDK Build-Tools 28.0.3 not accepted.

在cmd里切换到Android SDK安装目录\tools\bin,运行命令

sdkmanager.bat --licenses

然后一路y就行

elasticsearch-head连接不上elasticsearch

1、打开elasticsearchHome\config\elasticsearch.yml,增加如下配置项

http.cors.enabled: true
http.cors.allow-origin: "*"

2、修改elasticsearch-headHome\Gruntfile.js文件,修改connect\server配置项,增加hostname为"*"

        connect: {
            server: {
                options: {
                    hostname:"*",
                    port: 9100,
                    base: '.',
                    keepalive: true
                }
            }
        }

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值